daylight saving time

DexterM
Posts: 9
Joined: Mon Oct 27, 2025 2:44 pm

daylight saving time

Postby DexterM » Tue Nov 25, 2025 12:03 pm

Is available information that daylight savings is in effect?
Main device need to know this information.
I see only: +CIPSNTPTIME:Tue Nov 25 12:31:21 2025<CR><LF>
Is available any other format of data?
E.g. in other module (Quectel) is:
"2017/01/13,11:41:23+32,0"
that last value shows adjustment (0 - no adjustment, other - adjustment is in effect, etc.)

lbernstone
Posts: 1131
Joined: Mon Jul 22, 2019 3:20 pm

Re: daylight saving time

Postby lbernstone » Tue Nov 25, 2025 6:15 pm

You should keep times in UTC until the point of consumption. The timezone (and therefore the DST status) is only relevant to humans. If you are presenting it in a webpage, you should use javascript to get the client's locale. If your point of delivery is an esp32, you can use the tm_isdst value of tm to determine if DST is active, once you have set a timezone:

Code: Select all

  struct tm timeinfo;
  getLocalTime(&timeinfo);
  isDst = timeinfo.tm_isdst;

DexterM
Posts: 9
Joined: Mon Oct 27, 2025 2:44 pm

Re: daylight saving time

Postby DexterM » Wed Nov 26, 2025 12:50 pm

Thank You @lbernstone for answare.
Upon further consideration, ESP provides time from an SNTP server (UTC). If we configure a time zone, it's the local time (e.g., UTC+1). The LTE module, on the other hand, returns the operator's local time, which already takes into account the offset related to daylight saving. Therefore, the DST parameter is present in the time format returned by the LTE module, but it is not (and cannot be) in the time format returned by ESP (because it would always be 0). Am I understanding correctly?

lbernstone
Posts: 1131
Joined: Mon Jul 22, 2019 3:20 pm

Re: daylight saving time

Postby lbernstone » Wed Nov 26, 2025 3:50 pm

Are you sure the LTE module cannot give you UTC time? AT+CCLK? is the standard command for time. Perhaps you need to call the SNTP command once to have it retrieve the time from the network (which returns localtime), but then you can use the normal clock command for your timekeeping. If you keep everything in UTC internally until you write to a file/socket, then it will make more maintainable code, and you won't have to be translating back and forth all the time.

DexterM
Posts: 9
Joined: Mon Oct 27, 2025 2:44 pm

Re: daylight saving time

Postby DexterM » Thu Nov 27, 2025 8:00 pm

Sure, UTC is available in LTE module but it was more convenient in my usecase to use local time adjusted and marked with DST flag by operator.

Unfortunately after migrating from LTE to ESP had to change RTC maintenance since there was not live DST available.

This is little more complicated in my device, because there is also external, battery backuped, RTC that must be synchronised and have to be able to work (give timestamps) and shift time (DST) also without internet availability and with power off periods.
I think it was more convenient to set it with local time and then only read a stamps and realise time shifting (DST).
Thank You

esp-at
Espressif staff
Espressif staff
Posts: 335
Joined: Mon May 09, 2022 3:00 am

Re: daylight saving time

Postby esp-at » Wed Dec 17, 2025 7:12 am

The AT solution does not provide a dedicated command for handling daylight saving time.
You can either convert the UTC time on the host side, or define a custom AT command to implement this functionality yourself.

Who is online

Users browsing this forum: No registered users and 1 guest