Jump to content

Convert 24 hour format to 12 hour format?


Recommended Posts

A Google search for "javascript parse 24-hour time" returns several results.


This one seems to work for me:



You can just copy that code into your rule, or into your JavaScript Globals, and then do this:

return FormatDate(parseTime(Field("YourFieldName")), "h:nn A");

However, for a more robust solution, I would bring in the Date.js library for anything like this. You can download the file and either put it in your Plug-ins folder [C:\Program Files (x86)\PTI\FusionPro\Plug-ins], or copy-and-paste the entire contents into your JavaScript Globals. Then you can create a rule as simple as this:

return Date.parseExact(Field("YourFieldName"), ["HHmm", "Hmm"]).toString("h:mm tt");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...