Format | +Result | +|
---|---|---|
+ + ISO 8601, RFC 3339 + + | +
+ {formatDate(currentDate, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}
+ + + date-fns format:{' '} +
+ yyyy-MM-dd'T'HH:mm:ss.SSSxxx
+
+
+ |
+ + |
+ + RFC 822/2822 + + | +
+ {formatDate(currentDate, 'EEE, dd MMM yyyy HH:mm:ss xx')}
+ + + date-fns format:{' '} +
+ EEE, dd MMM yyyy HH:mm:ss xx
+
+
+ |
+ |
Unix timestamp (s) | +
+ {Math.floor(currentDate.getTime() / 1000)}
+ + + date-fns format:{' '} +
+ t
+
+
+ |
+ |
Unix timestamp (ms) | +
+ {currentDate.getTime()}
+ + + date-fns format:{' '} +
+ T
+
+
+ |
+
+ This tool allows you to convert a date to a unix timestamp + (seconds or milliseconds) and vice versa, and view the date in + different formats (ISO 8601, RFC 3339, RFC 822/2822). You can + also format the date in a custom format using the{' '} + + date-fns library format + + . +
+
+ A Unix timestamp (or epoch time) is the number of seconds or
+ milliseconds that have elapsed since 00:00:00 Coordinated
+ Universal Time (UTC), Thursday, 1 January 1970. It is used in
+ many programming languages and systems to represent dates and
+ times.
+
+
+ Unix timestamps are often used in APIs to represent dates and
+ times because they are easy to work with and can be converted to
+ any time zone.
+
+ date-fns is a modern JavaScript date utility
+ library that provides comprehensive, yet simple and consistent
+ toolset for manipulating JavaScript dates in a browser or
+ Node.js environment.
+
+
+ It is used in this tool to format dates and unix timestamps in
+ different formats using predefined patterns. You can find the
+ list of available patterns in the{' '}
+
+ date-fns documentation
+
+ .
+