Tuesday, March 22, 2016

How To Get milliseconds Displayed in DateTime Via PeopleCode

In most cases, milliseconds may not matter in your coding, but in few cases, it could make a big difference.

As you know, when you are using %DateTime or %Time, the milliseconds shows .000000, so frustrating...

There are few ways you can do to remedy this issue, some use SQL to get a current_timestamp, some use a java class to get a server time, etc.

Here is one for peoplecode:

Local datetime &NewDateTime = DateTimeValue(Substring(String(%Datetime), 1, Len(String(%Datetime)) - 6) | Substring(String(%PerfTime), Len(String(%PerfTime)) - 5, Len(String(%PerfTime))));

Hope this helps and Happy Coding!

No comments:

Post a Comment