Flowers4Algernon Posted July 17, 2021 Report Share Posted July 17, 2021 Hi, I wanted to convert time from my table to 12-hr format. I have used this formula and it works as expected.REPLACE(SUBSTRING(CONVERT(VARCHAR,[@field:datefield], 131),12,18),'.0000000','') May I ask if you guys have any more solutions to this? Quote Link to comment Share on other sites More sharing options...
0 Kurumi Posted July 19, 2021 Report Share Posted July 19, 2021 Your formula is great! Thanks for sharing. Hmm, you can try JavaScript in the DataPage as well? https://stackoverflow.com/questions/13898423/javascript-convert-24-hour-time-of-day-string-to-12-hour-time-with-am-pm-and-nohttps://www.geeksforgeeks.org/convert-time-from-24-hour-clock-to-12-hour-clock-format/ Flowers4Algernon 1 Quote Link to comment Share on other sites More sharing options...
0 NiceDuck Posted July 22, 2021 Report Share Posted July 22, 2021 Case when DatePart(hour,[@field: date]) > 12 then DateAdd(hour, -12, [@field:date]) + ' PM' else [@field:date] + ' AM' end its a lot longer than what you have but oh well... Flowers4Algernon 1 Quote Link to comment Share on other sites More sharing options...
Question
Flowers4Algernon
Hi, I wanted to convert time from my table to 12-hr format. I have used this formula and it works as expected.
REPLACE(SUBSTRING(CONVERT(VARCHAR,[@field:datefield], 131),12,18),'.0000000','')
May I ask if you guys have any more solutions to this?
Link to comment
Share on other sites
2 answers to this question
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.