How to get the current date

I need the current date & it is not easy to find how in elements documentation nor in Talk. Hope someone knows off top of head & can tell me. I need it in mm/dd/yy format, but I can’t easily find how to get it in any format.

What platform? On any of them, if you use our cross-platform Elements RTL library you can use DateTime.UtcNow.

I’m using Browser based Water Island. All work done in browser & s/b compatible with the modern browsers, Chrome, FireFox, Edge, Safari, Apple OS.

So this works?

method GetDate(): String;
var sDateTime := DateTime.UtcNow;
var sDate := sDateTime.Month + ‘/’ + sDateTime.Day + ‘/’ + sDateTime.Year;
RESULT := sDate;

1 Like

Yes. You can also use ToString() on the datetime, with a format string, instead of manually putting therapierest together.


Or the like.

1 Like