logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

datetime_parse.mdoc (1371B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .\"
  5. Multiple different but unambiguous formats are supported:
  6. @epoch, Email, asctime, RFC3339.
  7. .Ss @epoch
  8. Leading @ (at) symbol followed by
  9. the Unix timestamp (number of seconds before and after 1970-01-01 00:00:00Z),
  10. for example
  11. .Ql @1698791420
  12. corresponds to 2023-10-31 23:30:20 UTC
  13. .Ss Email
  14. Also known as "Internet Message Format" (RFC5322, RFC2822, RFC822), for example:
  15. .Bl -bullet -compact
  16. .It
  17. .Ql Fri, 21 Nov 1997 09:55:06 -0600
  18. .It
  19. .Ql 21 Nov 97 09:55:06 GMT
  20. .El
  21. .Ss asctime
  22. Output format of
  23. .Xr asctime 3 ,
  24. for example:
  25. .Ql Sun Sep 16 01:03:52 1973
  26. .Ss RFC3339
  27. Profile of ISO\ 8601:1988, found in modern protocols and file formats.
  28. Formatted as
  29. .Ql YYYY-MM-DDThh:mm:SS[frac][tz] ,
  30. where:
  31. .Bl -tag -width Ds
  32. .It Ql YYYY-MM-DD
  33. Corresponds to %Y-%m-%d of
  34. .Xr strptime 3 .
  35. .It Ql T
  36. Is either
  37. .Ql T
  38. or a space.
  39. .It Ql [frac]
  40. Is either empty, or fractional seconds starting with either a comma
  41. .Pq \&,
  42. or a period
  43. .Pq \&. .
  44. .It Ql [tz]
  45. When empty it corresponds to local time.
  46. Otherwise it can be an UTC offset in the format
  47. .Ql [+-]HH:?MM
  48. or the letter
  49. .Qq Z ,
  50. signifying UTC.
  51. .El
  52. .Pp
  53. Some examples:
  54. .Bl -bullet -compact
  55. .It
  56. .Ql 2003-06-02T13:37:42.713Z
  57. .It
  58. .Ql 1971-01-02T03:04:05.678+0900
  59. .El