ricky10ss Posted September 19, 2012 Share Posted September 19, 2012 Hello, Does anyone know a rule that can convert 24 hour time that I have in a spreadsheet to 12 hour time? Example 830 should be 8:30 AM and 1830 should be 6:30 PM Thanks in advance of any help. Using Windows XP and 7 with FusionPro 8.0.20. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 19, 2012 Share Posted September 19, 2012 A Google search for "javascript parse 24-hour time" returns several results. This one seems to work for me: http://stackoverflow.com/a/3998370 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"); Quote Link to comment Share on other sites More sharing options...
ricky10ss Posted September 20, 2012 Author Share Posted September 20, 2012 Thank you very much. That did the trick. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.