:Namespace netDateTime ⍝ Functions related to Dates and Time (⎕IO ⎕ML ⎕WX)←1 3 3 DayOfWeek←{ ⍝ ⍵ = .Net Date Object ⍝ Result = Day of the Week as a Number (Sunday = 1) ⎕USING←'System,mscorlib.dll' 1+Int32 ⎕CLASS ⍵.DayOfWeek } FormatDate←{ ⍝ ⍵ = .Net Date Object ⍝ ⍺ = Format String ⍝ Result = Date formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' XmlConvert.ToString(⍵(,⍺)) } ∇ r←NowToDateString;⎕USING ⍝ r = Current Date formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' r←XmlConvert.ToString((DateTime.Now)(,'dddd MMMM d yyyy')) ∇ ∇ r←NowToTimeString;⎕USING ⍝ r = Current Time formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' r←XmlConvert.ToString((DateTime.Now)(,'HH:mm:ss')) ∇ OADateToDateObj←{ ⍝ ⍵ = OADate as a number ⍝ Result = .Net Date Object ⎕USING←'System,mscorlib.dll' DateTime.FromOADate ⍵ } OADateToDateString←{ ⍝ ⍵ = OADate as a number ⍝ Result = Date formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' XmlConvert.ToString((DateTime.FromOADate ⍵)(,'dddd, MMMM d, yyyy')) } OADateToTimeString←{ ⍝ ⍵ = OADate as a number ⍝ Result = Time formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' XmlConvert.ToString((DateTime.FromOADate ⍵)(,'HH:mm:ss')) } OADateToTs←{ ⍝ ⍵ = OADate as a number ⍝ Result = ⎕TS ⎕USING←'System,mscorlib.dll' ⍺←DateTime.FromOADate ⍵ ⍺.(Year Month Day Hour Minute Second Millisecond) } TsToDateObject←{ ⍝ ⍵ = ⎕TS ⍝ Result = .Net Date Object ⎕USING←'System,mscorlib.dll' ⎕NEW DateTime ⍵ } TsToDateString←{ ⍝ ⍵ = ⎕TS ⍝ Result = Date formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' XmlConvert.ToString(((⎕NEW DateTime ⍵))(,'dddd, MMMM d, yyyy')) } TsToDayOfWeek←{ ⍝ ⍵ = ⎕TS ⍝ Result = Day of the week ⎕USING←'System,mscorlib.dll' (⎕NEW DateTime ⍵).DayOfWeek } TsToOADate←{ ⍝ ⍵ = ⎕TS ⍝ Result = OADate as a number ⎕USING←'System,mscorlib.dll' (⎕NEW DateTime ⍵).ToOADate } TsToTimeString←{ ⍝ ⍵ = OADate as a number ⍝ Result = Time formatted to a String ⎕USING←'System,mscorlib.dll' 'System.Xml,System.Xml.dll' XmlConvert.ToString(((⎕NEW DateTime ⍵))(,'HH:mm:ss')) } :EndNamespace