Please see the code and output below.
If I convert a date/time string to Unix time and then back again, somehow an hour is added.
I have confirmed that:
- my Zoho and CRM time zone settings are Europe/London
- time in London is currently GMT
- the date/time string is correctly converted to Unix time
- the toTime() function seems not to be working
Why is the conversion back incorrect? Can anyone help?
Thanks very much
Mark
>>>>
dateTimeString = "2023-12-11 19:00:00";
unixTime = dateTimeString.unixEpoch("Europe/London");
revert_to_dateTimeString = (unixTime).toTime("yyyy-MM-dd HH:mm:ss","Europe/London");
info "Any date/time: " + dateTimeString;
info "Unix time: " + unixTime;
info "Unix time converted back: " + revert_to_dateTimeString;
// Any date/time: 2023-12-11 19:00:00
// Unix time: 1702321200000
// Unix time converted back: 11-Dec-2023 20:00:00