How do we convert the date time to a specific timezone in calculation field

i wanted to show the date time in specific time zone using australia, sydney
i tried to use this specific function to convert it

const target_startdate = date_fns_tz.zonedTimeToUtc(@From Date, 'Australia/Sydney');

but the result is converted automatically to a GMT +00 see image below

Screenshot 2024-03-05 123746

@comfreakph

Does this do more what you were after:

const b = @Created on;
const aDate = date_fns_tz.utcToZonedTime(@Created on, 'Australia/Sydney');
const fADate = date_fns_tz.format(aDate, 'yyyy-MM-dd HH:mm:ss');
`${b} <br> ${fADate}`

You can play with the format to get it how you want and I am fairly sure you can do the conversion and format in one line if you want.

1 Like

Thanks @Jason will try this