DATEZONE(1)

๐Ÿ“ฆ
version 0.4.11 ยท 5 versions
, in alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

๐Ÿ’– NAME ๐Ÿ’–

okay so this is datezone, from the datezone(1) manual page in the User Commands section โ€” and bestie, it does exactly one iconic thing: it converts DATE/TIMEs between timezones. that's it, that's the whole job, and it slays at it. ๐ŸŒโœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

datezone [OPTION]...  [ZONENAME]... [DATE/TIME]...

โœจ DESCRIPTION โœจ

So the vibe is: you hand it DATE/TIMEs and it converts them between timezones. If you justโ€ฆ don't give it a DATE/TIME at all? It defaults to now. no thoughts, just the present moment. ๐Ÿ•

DATE/TIME can also be one of these special little guys:

  • now โ€” interpreted as the current (UTC) time stamp
  • time โ€” the time part of the current (UTC) time stamp
  • today โ€” the current date (according to UTC)
  • tomo[rrow] โ€” tomorrow's date (according to UTC)
  • y[ester]day โ€” yesterday's date (according to UTC)

Two rules that lowkey matter a lot:

  • When DATE/TIME is a date (i.e. the time component is omitted) the result will show the timezone offset at the end of that day.
  • When DATE/TIME is a time (i.e. the date component is omitted) the conversion takes place on the date as specified by --base/-b, by default the current date.

๐Ÿ’… Recognized OPTIONs ๐Ÿ’…

  • -h, --help โ€” display this help and exit. classic. ๐Ÿซถ
  • -V, --version โ€” output version information and exit. also classic.
  • -q, --quiet โ€” Suppress message about date/time or zonename parser errors and fix-ups. The default is to print a warning or the fixed up value and return error code 2. so if you want silence instead of being lovingly corrected, this is your girl. ๐Ÿคซ
  • -b, --base=DT โ€” For underspecified input use DT as a fallback to fill in missing fields. Also used for ambiguous format specifiers to position their range on the absolute time line. Must be a date/time in ISO8601 format. If omitted defaults to the current date/time.
  • -i, --input-format=STRING... โ€” Input format, can be used multiple times. Each date/time will be passed to the input format parsers in the order they are given, if a date/time can be read successfully with a given input format specifier string, that value will be used.
  • --from-locale=LOCALE โ€” Interpret dates on stdin or the command line as coming from the locale LOCALE, this would only affect month and weekday names as input formats have to be specified explicitly.
  • --from-zone=ZONE โ€” Interpret dates on stdin or the command line as coming from the time zone ZONE.
  • --next โ€” Show next transition from/to DST. โญ๏ธ
  • --prev โ€” Show previous transition from/to DST. โฎ๏ธ

๐ŸŽ€ FORMAT SPECS ๐ŸŽ€

Format specs in dateutils are similar to posix' strftime(). ๐Ÿงš

However, due to a broader range of supported calendars dateutils must employ different rules.

๐ŸŒธ Date specs ๐ŸŒธ

  • %a โ€” The abbreviated weekday name
  • %A โ€” The full weekday name
  • %_a โ€” The weekday name shortened to a single character (MTWRFAS)
  • %b โ€” The abbreviated month name
  • %B โ€” The full month name
  • %_b โ€” The month name shortened to a single character (FGHJKMNQUVXZ)
  • %c โ€” The count of the weekday within the month (range 00 to 05)
  • %C โ€” The count of the weekday within the year (range 00 to 53)
  • %d โ€” The day of the month, 2 digits (range 00 to 31)
  • %D โ€” The day of the year, 3 digits (range 000 to 366)
  • %F โ€” Equivalent to %Y-%m-%d (ymd's canonical format)
  • %g โ€” ISO week date year without the century (range 00 to 99)
  • %G โ€” ISO week date year including the century
  • %j โ€” Equivalent to %D
  • %m โ€” The month in the current calendar (range 00 to 12)
  • %Q โ€” The quarter of the year (range Q1 to Q4)
  • %q โ€” The number of the quarter (range 01 to 04)
  • %s โ€” The number of seconds since the Epoch.
  • %u โ€” The weekday as number (range 01 to 07, Sunday being 07)
  • %U โ€” The week count, day of week is Sun (range 00 to 53)
  • %V โ€” The ISO week count, day of week is Mon (range 01 to 53)
  • %w โ€” The weekday as number (range 00 to 06, Sunday being 00)
  • %W โ€” The week count, day of week is Mon (range 00 to 53)
  • %y โ€” The year without a century (range 00 to 99)
  • %Y โ€” The year including the century
  • %_y โ€” The year shortened to a single digit
  • %Z โ€” The zone offset in hours and minutes (HH:MM) with a preceding sign (+ for offsets east of UTC, - for offsets west of UTC)

and the roman numeral era: ๐Ÿ›๏ธ

  • %Od โ€” The day as roman numerals
  • %Om โ€” The month as roman numerals
  • %Oy โ€” The two digit year as roman numerals
  • %OY โ€” The year including the century as roman numerals

the calendar-specific ones:

  • %rs โ€” In time systems whose Epoch is different from the unix Epoch, this selects the number of seconds since then.
  • %rY โ€” In calendars with years that don't coincide with the Gregorian years, this selects the calendar's year.

ordinals, because we're fancy: โœจ

  • %dth โ€” The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
  • %mth โ€” The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.

and the business-day girlies: ๐Ÿ’ผ

  • %db โ€” The business day of the month (since last month's ultimo)
  • %dB โ€” Number of business days until this month's ultimo

โฐ Time specs โฐ

  • %H โ€” The hour of the day using a 24h clock, 2 digits (range 00 to 23)
  • %I โ€” The hour of the day using a 12h clock, 2 digits (range 01 to 12)
  • %M โ€” The minute (range 00 to 59)
  • %N โ€” The nanoseconds (range 000000000 to 999999999)
  • %p โ€” The string AM or PM, noon is PM and midnight is AM.
  • %P โ€” Like %p but in lowercase
  • %S โ€” The seconds (range 00 to 60, 60 is for leap seconds)
  • %T โ€” Equivalent to %H:%M:%S

๐ŸŒˆ General specs ๐ŸŒˆ

  • %n โ€” A newline character
  • %t โ€” A tab character
  • %% โ€” A literal % character

๐Ÿช„ Modifiers ๐Ÿช„

  • %O โ€” Modifier to turn decimal numbers into Roman numerals
  • %r โ€” Modifier to turn units into real units
  • %0 โ€” Modifier to turn on zero prefixes
  • %SPC โ€” Modifier to turn on space prefixes
  • %- โ€” Modifier to turn off prefixes altogether
  • th โ€” Suffix, read and print ordinal numbers
  • b โ€” Suffix, treat days as business days
By design dates before 1601-01-01 are not supported. not a bug, a whole design choice, and we respect it. ๐Ÿšซ

For conformity here is a list of calendar designators and their corresponding format string:

  • ymd โ€” %Y-%m-%d
  • ymcw โ€” %Y-%m-%c-%w
  • ywd โ€” %rY-W%V-%u
  • bizda โ€” %Y-%m-%db
  • lilian โ€” n/a
  • ldn โ€” n/a
  • julian โ€” n/a
  • jdn โ€” n/a
  • matlab โ€” n/a
  • mdn โ€” n/a

These designators can be used as output format string, moreover, @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used as input format string.


๐ŸŒธ EXAMPLES ๐ŸŒธ

no zone given? you get UTC, and honestly? she said "you're welcome". ๐Ÿ’–

$ datezone 2012-03-04T12:04:11
2012-03-04T12:04:11+00:00
$

name a zone, get that zone. iconic behavior. ๐Ÿฆ‹

$ datezone Europe/Berlin 2012-03-04T12:04:11
2012-03-04T13:04:11+01:00     Europe/Berlin
$

zone after the timestamp? also valid, we're flexible like that.

$ datezone 2012-03-04T12:04:11 UTC
2012-03-04T12:04:11+00:00     UTC
$

and the flex: multiple zones ร— multiple date/times, all converted, in order. she's doing the MOST. ๐Ÿ‘‘

$ datezone Europe/Berlin Australia/Sydney 2012-01-01T14:04:00 2012-05-14T12:04:00
2012-01-01T15:04:00+01:00     Europe/Berlin
2012-01-02T01:04:00+11:00     Australia/Sydney
2012-05-14T14:04:00+02:00     Europe/Berlin
2012-05-14T22:04:00+10:00     Australia/Sydney
$

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Written by Sebastian Freundt <freundt@fresse.org> โ€” thank you for your service, legend. ๐Ÿซก๐Ÿ’œ


๐Ÿ› REPORTING BUGS ๐Ÿ›

Report bugs to: https://github.com/hroptatyr/dateutils/issues

fr fr if something's cursed, tell them there, not me. ๐Ÿ™ˆ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

The full documentation for datezone is maintained as a Texinfo manual. If the info and datezone programs are properly installed at your site, the command

info (dateutils)datezone

should give you access to the complete manual. ๐Ÿ“–โœจ


okay bestie that's the whole page ๐Ÿ’… this was dateutils 0.4.11, dated January 2024, and this lil DATEZONE(1) manual is officially out. go convert some timezones, you got this. ๐ŸŽ€๐Ÿฆ‹๐Ÿ’–