SNTP AT Command Set
This chapter introduces the SNTP AT command set. Adaptations may vary across different modules. For details, see Firmware Versions and Feature Differences.
AT+SNTPTIME: Query SNTP time
AT+SNTPTIMECFG: Query and set SNTP time zone and servers
AT+SNTPINTV: Query and set SNTP refresh interval
AT+SNTPTIME: Query SNTP time
Description
SNTP is disabled by default. After connecting to the network, use AT+SNTPTIMECFG to enable it. When not enabled,
queries return local RTC time.
Query Command
Command:
AT+SNTPTIME?
Response:
+SNTPTIME:<week> <month> <day> <HH>:<mm>:<ss> <yyyy>
OK
Parameters
<week>: Day of week [Mon,Tue,Wed,Thu,Fri,Sat,Sun]
<month>: Month [Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec]
<day>: Day
<HH>: Hour
<mm>: Minute
<ss>: Second
<yyyy>: Year
Example
AT+SNTPTIMECFG=1,8//开启 SNTP
OK
AT+SNTPTIME?//同步成功后查询时间
+SNTPTIME:Wed May 03 10:49:41 2023
OK
AT+SNTPTIMECFG query and set SNTP time zone and servers
Set Command
Command:
AT+SNTPTIMECFG=<enable>,<timezone>[,<SNTP server1>,<SNTP server2>,<SNTP server3>]
Response:
OK
Parameters
<enable>: SNTP refresh service setting; 0: disabled; 1: enabled
<timezone>: Time zone, range -12 to +14
<SNTP server1/2/3>: SNTP server domain names. Defaults to “cn.ntp.org.cn”, “ntp.sjtu.edu.cn”, “us.pool.ntp.org” if omitted
Example
AT+SNTPTIMECFG=1,8,cn.ntp.org.cn
OK
Query Command
Command:
AT+SNTPTIMECFG?
Response:
+SNTPTIMECFG:<enable>,<timezone>[,<SNTP server1>,<SNTP server2>,<SNTP server3>]
OK
Parameters
<SNTPTIME>: Response time
<enable>: Whether SNTP refresh service is running; 0: not running; 1: running
<timezone>: Time zone, range -12 to +14
<SNTP server1/2/3>: SNTP server domain names
Example
AT+SNTPTIMECFG?
+SNTPTIMECFG:1,8,"cn.ntp.org.cn","ntp.sjtu.edu.cn","us.pool.ntp.org"
OK
AT+SNTPINTV query and set SNTP refresh interval
Set Command
Command:
AT+SNTPINTV=<interval second>
Response:
OK
Parameters
<interval second>: Refresh interval in seconds; range 15~4294967
Example
AT+SNTPINTV=15
OK
Query Command
Command:
AT+SNTPINTV?
Response:
+SNTPINTV:<interval second>
OK
interval second:刷新间隔,单位 S
Parameters
<interval second>: Refresh interval in seconds
Example
AT+SNTPINTV?
+SNTPINTV:3600
OK