]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: time zone conversion example
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 May 2023 16:16:29 +0000 (09:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 May 2023 16:17:27 +0000 (09:17 -0700)
* doc/coreutils.texi (Examples of date):
Give time zone conversion example.

doc/coreutils.texi

index b7c6bfe4289fe5e37b9659bbea9369ce0fbf05a3..6a693e283c38cd5f139230aeafe246780d341cd8 100644 (file)
@@ -16918,6 +16918,16 @@ date --date='1970-01-01 00:02:00 +0000' +%s
 120
 @end example
 
+To convert a date string from one time zone @var{from} to another @var{to},
+specify @samp{TZ="@var{from}"} in the environment and @samp{TZ="@var{to}"}
+in the @option{--date} option.  @xref{Specifying time zone rules}.
+For example:
+
+@smallexample
+TZ="Asia/Tokyo" date --date='TZ="America/New_York" 2023-05-07 12:23'
+Mon May @ 8 01:23:00 JST 2023
+@end smallexample
+
 If you do not specify time zone information in the date string,
 @command{date} uses your computer's idea of the time zone when
 interpreting the string.  For example, if your computer's time zone is