How do i convert 24 hour format in a variable to 12 hour format

0
i have a variable which has for ex: date/time as 20230519 12:52:23 AM,  now when i add 2 hours to this, it becomes 20230519 14:52:23 PM,  instead i need this to be 20230519 02:52:23 AM ,    this is what happens at each step   "2023-05-19T12:58:48 AM\n" "2023-05-19T12:58:48 AM" 2023-05-19T12:58:48 AM   UTC time: 2023-05-19 07:28:48.000 Session time: 2023-05-19 12:58:48.000 +0530 Adding + 2hours  ( addHours(($get_cst_time_date), 2) ) UTC time: 2023-05-19 09:28:48.000 Session time: 2023-05-19 14:58:48.000 +0530 20230519 14:58:48 PM
asked
1 answers
1

If you want it to be 02:52:23 AM you would need to substract 10 hours. Not adding 2hours.

Regards,

Ronald

[EDIT] If you want to show a 12 hour format you need to do something else. See documentation here: https://docs.mendix.com/refguide/parse-and-format-date-function-calls/ Use K and h to formtat date time to a 12 hour format.

answered