How To: date format HH:MM TT (AM/PM)


#1

I believe in be the change you want to see in the world.

Was searching for this for a bit and finally figured it out so I am sharing it here for a future person to find.

if you want to display local time as HH:MM TT (AM/PM) aka 02:33 PM it is not possible.

Here is some code that will work to do this.

[[Now.toLocaleTimeString().substr(0,4 )]] [[Now.toLocaleTimeString().substr(8,10 )]]

Basically it is subtracting everything after the 5th character and then repeating the string and subtracting everything before the 8th character.

if you have a more efficient way I would love to know how to do it.


#2

Hi Pbomar -

No quite sure how to insert or use this code of yours as I was also trying to display local time. Where should I add this code?

Cool to see I was not alone :slight_smile:
Thanks.


#3

Select “Onpageload” interaction

Select “Set Text” from left hand list

Choose text you want to change

Select “value” from dropdown menu

Type code in textfield beside dropdown menu.

Enjoy.


unlisted #4

closed #5