Outsystems Date Objects and Milliseconds

Outsystems Date Objects and Milliseconds

Simple question here. Apparently, not a simple answer... How do I get milliseconds from an Outsystems date object? I would like the ability to have access to milliseconds in some javascript code, but nowhere that I can find in OutSystems is this even possible. Everyone in the world uses milliseconds so I am quite surprised to see this basic functionality isnt available. Perhaps I am missing something?
Hi Nate.
I believe they removed ms from the IDE's object to increase simplicity.

However, keep in mind that you always have all the functionality of the stack you're using available to you.
This means you can easily extend on the platform with some .NET or JAVA.

Eg. Native CurrDateTime() won't return miliseconds for you.
On the upside, all you have to do is build an extension, with a function named CurrDateTimeMS() that returns a record (in order to have a single output and be set as function) with attributes DateTime and Miliseconds. Fill the first attribute with DateTime.Now and the second with DateTime.Now.Miliseconds.

On the downside. If you need to save it in the database, you'll need an extra attribute for the miliseconds alone.

P.S. Don't try to get .Miliseconds from a datetime obtained through the built in functions of the IDE, it'll be 0. If you need ms, the DateTime will have to be generated inside the extension and ms info will be lost once you convert it to the platform's DateTime, hence the extra attribute to store miliseconds.

best regards,
Thanks Antonio,

That is a bit more than I was expecting. I'm sure I can do it (haven't created an extension yet), but I'm really surprised and a little dissappointed it's not possible within Service Studio itself. I understand for simplicity reasons why OutSystems might want to make it harder to get to, but to all out disallow it is quite foolish. Milliseconds is the standard for everything. I'm shaking my head as I write this. Just seems a really stupid decision. Sorry, don't mean to be negative, just quite astonished.

Yw. It's a faily simple extension to start with. Lucky you! heh
Well, in order to reduce complexity and entry level, they had to sacrifice some things. I can understand that.

To be honest, the only cases where I had the need to use milisecond precision, was to calculate operation length, and for that I used .Ticks and/or the TimeSpan class. Never used the miliseconds from DateTime for anything.

If you have any doubts with the extension, ask away. :)

One of my coworkers is writing an offline solution using a polyfill (supporting IndexDB and WebSQL) so much of his html is handcoded. He has various sorting issues concerning dates. In some cases dates are formatted one way on one system (iPad Safari) and differently on the others (Windows Chrome/IE). To complicate things, some sites have formatting set up differently than others too. I told him just to use millis. It would solve all his headaches, and you never need to worry about anything; it even handles timezones. Then we discovered OutSystems doesn't deal with millis.

Thanks for the tips though. I'm not going to be able to do this right away since it isn't a simple fix (relativelty speaking I know) and we are up against a deadline and that makes the boss nervous to try anything other than the tried and true. Oh well.

Ow, i see.
Maybe try running all Date objects in JavaScript through something like, this, to make sure it all ends up with the same format? Maybe setup the standard date format to yy-mm-dd hh:mm:ss (to match the platform standard).
Yes, that is essentially what he is doing now, but dates are coming down in multiple places from OutSystems, so he's having to go through and fix it in every location. Plus, from what he explained, we change the platform standard based on what each customer expects... therefore he needs to accomodate for multiple possible formats. Eh, it's alright. He's mostly got it working now. Milliseconds would have been much better though.