If you're lucky enough to build an application for a client based in a country that changes its clocks twice a year, then I'm opening this article without a 100% certain solution as I need to wait about 4 months until I can confirm this works.
Why?
I've covered this before in a fair few articles on this website but for clients in the US, where there could be 4 different timezones between customer, agent, HQ, server; we would create a separate table to manage this data. I can't do this for every client, so here's a quick snippet to just check if Daylight Savings are in effect for the United Kingdom.
How?
Based on the fact that the United Kingdom is on the Prime Meridian and when no daylight savings are in effect, the hour difference to UTC (Coordinated Universal Time) should be zero, then for checking if daylight savings is in effect in the UK, we should be able to take Greenwich Mean Time and compare to UTC.
b_IsDSTInEffect = if(zoho.currenttime.toString("HH:mm", "UTC") != zoho.currenttime.toString("HH:mm", "GMT"), true, false); info b_IsDSTInEffect; // v_TimeZoneOffset = if(b_IsDSTInEffect, "+01:00", "+00:00"); // // usage v_SendToCRM_DateTime = zoho.currenttime.toString("yyyy-MM-dd'T'HH:mm:ss","Europe/London") + v_TimeZoneOffset;
- b_IsDSTInEffect = if(zoho.currenttime.toString("HH:mm", "UTC") != zoho.currenttime.toString("HH:mm", "GMT"), true, false);
- info b_IsDSTInEffect;
- //
- v_TimeZoneOffset = if(b_IsDSTInEffect, "+01:00", "+00:00");
- //
- // usage
- v_SendToCRM_DateTime = zoho.currenttime.toString("yyyy-MM-dd'T'HH:mm:ss","Europe/London") + v_TimeZoneOffset;
Note(s):
- This was done in ZohoCreator which was showing a timezone of -0700 or PDT irrespective of the settings in the app being set to GMT.