adb shell date帮助
adb shell date --helpusage: date [-u] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]Set/get the current date/time. With no SET shows the current date.-d Show DATE instead of current time (convert date format)-D +FORMAT for SET or -d (instead of MMDDhhmm[[CC]YY][.ss])-r Use modification time of FILE instead of current date-u Use UTC instead of current timezoneSupported input formats:MMDDhhmm[[CC]YY][.ss] POSIX@UNIXTIME[.FRACTION] seconds since midnight 1970-01-01YYYY-MM-DD [hh:mm[:ss]] ISO 8601hh:mm[:ss] 24-hour time todayAll input formats can be preceded by TZ="id" to set the input time zoneseparately from the output time zone. Otherwise $TZ sets both.+FORMAT specifies display format string using strftime(3) syntax:%% literal % %n newline %t tab%S seconds (00-60) %M minute (00-59) %m month (01-12)%H hour (0-23) %I hour (01-12) %p AM/PM%y short year (00-99) %Y year %C century%a short weekday name %A weekday name %u day of week (1-7, 1=mon)%b short month name %B month name %Z timezone name%j day of year (001-366) %d day of month (01-31) %e day of month ( 1-31)%N nanosec (output only)%U Week of year (0-53 start sunday) %W Week of year (0-53 start monday)%V Week of year (1-53 start monday, week < 4 days not part of this year)%F "%Y-%m-%d" %R "%H:%M" %T "%H:%M:%S" %z numeric timezone%D "%m/%d/%y" %r "%I:%M:%S %p" %h "%b" %s unix epoch time%x locale date %X locale time %c locale date/time
1、设置时间
adb rootadb remountadb shell date "2023-01-11 18:00:00"adb shell "date 01111800.00"# 1月11号 下午6点/18点 :日落
adb rootadb remountadb shell date "2023-01-11 07:00:00"adb shell "date 01110700.00"# 1月11号 上午7点 : 日出
adb rootadb remountadb shell date "2023-01-11 08:00:00"adb shell "date 01110800.00"# 1月11号 上午8点
2、读取时间
adb shell "date"Tue Jan 11 00:01:53 CST 2022
3、设置时区
adb shell "setprop persist.sys.timezone Pacific/Midway"
Pacific/Midway为设置的时区
4、读取时区
adb shell "getprop persist.sys.timezone"Asia/Shanghai
来源地址:https://blog.csdn.net/sinat_31057219/article/details/128640993