Using .NET System.DateTime methods/properties

Posted by Lieven De Foor on 22-Feb-2017 04:47

Hi,

Is there any way to use the methods and properties on .NET System.DateTime?

Currently the System.DateTime type gets mapped to the ABL DATETIME data type, which effectively removes the ability to call methods/properties on it...

E.g. I want to get System.DateTime:Now:DayOfWeek, or format a System.DateTime using a .NET format in using System.DateTime:Now:ToString(myFormat).

Any ideas?

Posted by Mike Fechner on 22-Feb-2017 04:52

Sure: Get the DATETIME into a System.Object and CAST it to System.DataTime.
 
MESSAGE CAST (BOX (NOW), System.DateTime):DayOfWeek .
 
 

All Replies

Posted by Mike Fechner on 22-Feb-2017 04:52

Sure: Get the DATETIME into a System.Object and CAST it to System.DataTime.
 
MESSAGE CAST (BOX (NOW), System.DateTime):DayOfWeek .
 
 

Posted by Lieven De Foor on 22-Feb-2017 04:57

Didn't think of boxing/casting (tried creating a variable of System.DateTime but the compiler complained).

Thanks Mike, I'll give it a go!

Posted by Laura Stern on 22-Feb-2017 06:11

So clever Mike!

This thread is closed