Skip to main content
Question

Remove decimals of a second

  • January 31, 2019
  • 1 reply
  • 192 views

hlouie
Contributor
Forum|alt.badge.img+15

I'm creating an attribute for storing start date/time of processing with AttributeCreator and I'm having a hard time removing the decimal of a second.

 

@DateTimeFormat(@DateTimeNow(local),%a %b %d %H:%M:%S PST %Y)

 

Output

Thu Jan 31 11:16:20.9415159 PST 2019

 

Want

Thu Jan 31 11:16:20 PST 2019

1 reply

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • January 31, 2019

Hi @hlouie

The following will truncate the timestamp

@DateTimeFormat(@int(@DateTimeNow(localUnzoned)),%a %b %d %H:%M:%S PST %Y)

while this will round the timestamp

@DateTimeFormat(@round(@DateTimeNow(localUnzoned),0),%a %b %d %H:%M:%S PST %Y)

Both should output the timestamp in the format that you want. I hope this helps.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings