For Zoho services only


I'm currently part of a wider delivery team at Ascent Business Solutions, recognised as a leading Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions support organisations with everything from targeted technical fixes through to full Zoho CRM implementations and long-term platform adoption. Working as a team rather than a one-person consultancy allows projects to move forward consistently, with access to the right skills at each stage.

The team I manage specialises in API integrations between Zoho and third-party finance and commerce platforms such as Xero, Shopify, WooCommerce, and eBay. Much of our work involves solving integration challenges that fall outside standard documentation, supporting new ideas, new sectors, and evolving business models.

Success is measured through practical outcomes and return on investment, ranging from scaling small operations into high-turnover businesses to delivering rapid gains through online payments, automation, and streamlined digital workflows.

If you are looking for structured Zoho expertise backed by an established consultancy, you can contact Ascent Business Solutions on 0121 392 8140 (UK), email info@ascentbusiness.co.uk, or visit https://www.ascentbusiness.co.uk.
Zoho Deluge: Calculate start and end of Daylight Savings Time

Zoho Deluge: Calculate start and end of Daylight Savings Time

What?
An article to document how I calculated the start and end dates of when Daylight Savings Time is in effect.

Why?
Admittedly, most of Zoho apps have this built-in but here's some snippets of code in case you need them.

How?
I will use this to amend and refine but here's the snippets for the various DSTs around the world.

US (Except Arizona, Hawaii and US Territories?):
  • DST Start Starts Second Sunday in March at 2:00
  • DST End Ends First Sunday in November at 2:00
copyraw
//
// Starts Second Sunday in March at 2:00
v_FirstMonthDate = toTime(zoho.currentdate.toString("yyyy") + "-03-08 02:00:00");
//
// Ends First Sunday in November at 2:00
v_LastMonthDate = toTime(zoho.currentdate.toString("yyyy") + "-11-01 02:00:00");
//
// loop through each day in a week to get the start and end dates
for each v_DayIndex in {0,1,2,3,4,5,6}
{
    v_CheckDateStart = v_FirstMonthDate.addDay(v_DayIndex);
    if(v_CheckDateStart.toString("E")=="Sun")
    {
        v_DST_StartTime = v_CheckDateStart;
    }
    v_CheckDateEnd = v_LastMonthDate.addDay(v_DayIndex);
    if(v_CheckDateEnd.toString("E")=="Sun")
    {
        v_DST_EndTime = v_CheckDateEnd;
    }
}	
info "Start Date (Current Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm");
info "End Date (Current Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm");
//
// Starts Second Sunday in March at 2:00
v_FirstMonthDate = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-03-08 02:00:00");
//
// Ends First Sunday in November at 2:00
v_LastMonthDate = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-11-01 02:00:00");
//
// loop through each day in a week to get the start and end dates
for each v_DayIndex in {0,1,2,3,4,5,6}
{
    v_CheckDateStart = v_FirstMonthDate.addDay(v_DayIndex);
    if(v_CheckDateStart.toString("E")=="Sun")
    {
        v_DST_StartTime = v_CheckDateStart;
    }
    v_CheckDateEnd = v_LastMonthDate.addDay(v_DayIndex);
    if(v_CheckDateEnd.toString("E")=="Sun")
    {
        v_DST_EndTime = v_CheckDateEnd;
    }
}	
info "Start Date (Next Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm");
info "End Date (Next Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm");
  1.  // 
  2.  // Starts Second Sunday in March at 2:00 
  3.  v_FirstMonthDate = toTime(zoho.currentdate.toString("yyyy") + "-03-08 02:00:00")
  4.  // 
  5.  // Ends First Sunday in November at 2:00 
  6.  v_LastMonthDate = toTime(zoho.currentdate.toString("yyyy") + "-11-01 02:00:00")
  7.  // 
  8.  // loop through each day in a week to get the start and end dates 
  9.  for each v_DayIndex in {0,1,2,3,4,5,6} 
  10.  { 
  11.      v_CheckDateStart = v_FirstMonthDate.addDay(v_DayIndex)
  12.      if(v_CheckDateStart.toString("E")=="Sun") 
  13.      { 
  14.          v_DST_StartTime = v_CheckDateStart; 
  15.      } 
  16.      v_CheckDateEnd = v_LastMonthDate.addDay(v_DayIndex)
  17.      if(v_CheckDateEnd.toString("E")=="Sun") 
  18.      { 
  19.          v_DST_EndTime = v_CheckDateEnd; 
  20.      } 
  21.  } 
  22.  info "Start Date (Current Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm")
  23.  info "End Date (Current Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm")
  24.  // 
  25.  // Starts Second Sunday in March at 2:00 
  26.  v_FirstMonthDate = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-03-08 02:00:00")
  27.  // 
  28.  // Ends First Sunday in November at 2:00 
  29.  v_LastMonthDate = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-11-01 02:00:00")
  30.  // 
  31.  // loop through each day in a week to get the start and end dates 
  32.  for each v_DayIndex in {0,1,2,3,4,5,6} 
  33.  { 
  34.      v_CheckDateStart = v_FirstMonthDate.addDay(v_DayIndex)
  35.      if(v_CheckDateStart.toString("E")=="Sun") 
  36.      { 
  37.          v_DST_StartTime = v_CheckDateStart; 
  38.      } 
  39.      v_CheckDateEnd = v_LastMonthDate.addDay(v_DayIndex)
  40.      if(v_CheckDateEnd.toString("E")=="Sun") 
  41.      { 
  42.          v_DST_EndTime = v_CheckDateEnd; 
  43.      } 
  44.  } 
  45.  info "Start Date (Next Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm")
  46.  info "End Date (Next Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm")
Yields:
copyraw
Start Date (Current Year): Sunday, 2021-03-14 02:00
End Date (Current Year): Sunday, 2021-11-07 02:00
Start Date (Next Year): Sunday, 2022-03-13 02:00
End Date (Next Year): Sunday, 2022-11-06 02:00
  1.  Start Date (Current Year): Sunday, 2021-03-14 02:00 
  2.  End Date (Current Year): Sunday, 2021-11-07 02:00 
  3.  Start Date (Next Year): Sunday, 2022-03-13 02:00 
  4.  End Date (Next Year): Sunday, 2022-11-06 02:00 


Europe:
  • DST Start Last Sunday in March at 1:00 UTC
  • DST End Last Sunday in October at 1:00 UTC
copyraw
//
// Starts Last Sunday in March at 1:00 UTC
v_FromMonthDate1 = toTime(zoho.currentdate.toString("yyyy") + "-04-01 01:00:00");
//
// Ends Last Sunday in October at 1:00 UTC
v_ToMonthDate1 = toTime(zoho.currentdate.toString("yyyy") + "-10-31 01:00:00");
//
// loop through each day in a week to get the start and end dates
for each v_DayIndex in {0,1,2,3,4,5,6}
{
    v_CheckDateStart = v_FromMonthDate1.subDay(v_DayIndex);
    if(v_CheckDateStart.toString("E")=="Sun")
    {
        v_DST_StartTime = v_CheckDateStart;
    }
    v_CheckDateEnd = v_ToMonthDate1.subDay(v_DayIndex);
    if(v_CheckDateEnd.toString("E")=="Sun")
    {
        v_DST_EndTime = v_CheckDateEnd;
    }
}	
//
// output
info "Start Date (Current Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm");
info "End Date (Current Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm");
//
// *********************************************************
//
// Starts Last Sunday in March at 1:00 UTC
v_FromMonthDate1 = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-04-01 01:00:00");
//
// Ends Last Sunday in October at 1:00 UTC
v_ToMonthDate1 = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-10-31 01:00:00");
//
// loop through each day in a week to get the start and end dates
for each v_DayIndex in {0,1,2,3,4,5,6}
{
    v_CheckDateStart = v_FromMonthDate1.subDay(v_DayIndex);
    if(v_CheckDateStart.toString("E")=="Sun")
    {
        v_DST_StartTime = v_CheckDateStart;
    }
    v_CheckDateEnd = v_ToMonthDate1.subDay(v_DayIndex);
    if(v_CheckDateEnd.toString("E")=="Sun")
    {
        v_DST_EndTime = v_CheckDateEnd;
    }
}	
info "Start Date (Next Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm");
info "End Date (Next Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm");
  1.  // 
  2.  // Starts Last Sunday in March at 1:00 UTC 
  3.  v_FromMonthDate1 = toTime(zoho.currentdate.toString("yyyy") + "-04-01 01:00:00")
  4.  // 
  5.  // Ends Last Sunday in October at 1:00 UTC 
  6.  v_ToMonthDate1 = toTime(zoho.currentdate.toString("yyyy") + "-10-31 01:00:00")
  7.  // 
  8.  // loop through each day in a week to get the start and end dates 
  9.  for each v_DayIndex in {0,1,2,3,4,5,6} 
  10.  { 
  11.      v_CheckDateStart = v_FromMonthDate1.subDay(v_DayIndex)
  12.      if(v_CheckDateStart.toString("E")=="Sun") 
  13.      { 
  14.          v_DST_StartTime = v_CheckDateStart; 
  15.      } 
  16.      v_CheckDateEnd = v_ToMonthDate1.subDay(v_DayIndex)
  17.      if(v_CheckDateEnd.toString("E")=="Sun") 
  18.      { 
  19.          v_DST_EndTime = v_CheckDateEnd; 
  20.      } 
  21.  } 
  22.  // 
  23.  // output 
  24.  info "Start Date (Current Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm")
  25.  info "End Date (Current Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm")
  26.  // 
  27.  // ********************************************************* 
  28.  // 
  29.  // Starts Last Sunday in March at 1:00 UTC 
  30.  v_FromMonthDate1 = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-04-01 01:00:00")
  31.  // 
  32.  // Ends Last Sunday in October at 1:00 UTC 
  33.  v_ToMonthDate1 = toTime(zoho.currentdate.addYear(1).toString("yyyy") + "-10-31 01:00:00")
  34.  // 
  35.  // loop through each day in a week to get the start and end dates 
  36.  for each v_DayIndex in {0,1,2,3,4,5,6} 
  37.  { 
  38.      v_CheckDateStart = v_FromMonthDate1.subDay(v_DayIndex)
  39.      if(v_CheckDateStart.toString("E")=="Sun") 
  40.      { 
  41.          v_DST_StartTime = v_CheckDateStart; 
  42.      } 
  43.      v_CheckDateEnd = v_ToMonthDate1.subDay(v_DayIndex)
  44.      if(v_CheckDateEnd.toString("E")=="Sun") 
  45.      { 
  46.          v_DST_EndTime = v_CheckDateEnd; 
  47.      } 
  48.  } 
  49.  info "Start Date (Next Year): " + v_DST_StartTime.toString("EEEE, yyyy-MM-dd HH:mm")
  50.  info "End Date (Next Year): " + v_DST_EndTime.toString("EEEE, yyyy-MM-dd HH:mm")
Yields:
copyraw
Start Date (Current Year): Sunday, 2021-03-28 01:00
End Date (Current Year): Sunday, 2021-10-31 01:00
Start Date (Next Year): Sunday, 2022-03-27 01:00
End Date (Next Year): Sunday, 2022-10-30 01:00
  1.  Start Date (Current Year): Sunday, 2021-03-28 01:00 
  2.  End Date (Current Year): Sunday, 2021-10-31 01:00 
  3.  Start Date (Next Year): Sunday, 2022-03-27 01:00 
  4.  End Date (Next Year): Sunday, 2022-10-30 01:00 

Additional Note(s):
  • This has not been tested extensively. Do not use if you are unsure it is calculating correctly. I use these to store the values in a table that can be double-checked at a later date.

Source(s):
Category: Zoho Deluge :: Article: 326

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com