Date format to console.
Usage: ndate [-] [--date <date>] [-d <date>] [--date-style <full|long|medium|short|none>]
[--time-style <full|long|medium|short|none>] [--hour-cycles <h11|h12|h23|h24|none>]
[--time-zone <time-zone>] [-tz <time-zone>] [--local <locale>] [-l <locale>]
[--template <template>] [--json] [-j] [--sheet] [--utc] [--epoch] [--epoch-ms]
[--help] [-h] [--zero] [-z]
Install with homebrew:
brew install jondotsoy/core/ndate
Or install with deno:
deno install --allow-env=TZ,LANG https://deno.land/x/ndate@morgan-v0.4.3/ndate.ts
Samples use:
ndate # Tuesday, October 11, 2022 at 5:59:37 PM Chile Summer Time
ndate -d 2023-07-13T06:40 # Thursday, July 13, 2023 at 6:40:00 AM Chile Standard Time
ndate --local es-CL # martes, 11 de octubre de 2022, 17:59:14 hora de verano de Chile
ndate --local en-CL # Tuesday, October 11, 2022 at 5:59:37 PM Chile Summer Time
ndate --time-zone Asia/Tokyo --local en-US # Thursday, July 13, 2023 at 6:46:21 AM Japan Standard Time
LANG=en-US ndate --time-zone Asia/Tokyo # Thursday, July 13, 2023 at 6:46:21 AM Japan Standard Time
LANG=en-US TZ=Asia/Tokyo ndate # Thursday, July 13, 2023 at 6:46:21 AM Japan Standard Time
echo 2022-10-12T05:39:19.678Z | ndate - # Wednesday, October 12, 2022 at 2:39:19 AM Chile Summer Time
ndate -j # 2022-10-12T05:40:33.246Z
ndate --epoch # 1689255846
ndate --epoch-ms # 1689255823663
ndate --epoch-ms -z # 1689255823663%
ndate --template '{{utc_full_year}}-{{utc_month:padStart:2:0}}-{{utc_date:padStart:2:0}}' # 2023-06-13
ndate --template '{{YYYY}}{{MM}}{{DD}}{{HH}}{{MM}}{{SS}}{{MS}}' # 202330142030590781
ndate --sheet # =DATE(2023;10;28)+TIME(1;17;12)
{{epoch}}
: Date on unix time (It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970){{epoch_ms}}
: Date on unix time (It measures time by the number of milliseconds that have elapsed since 00:00:00 UTC on 1 January 1970){{json}}
: Time on ISO 8601 (Alias of{{iso8601}}
){{iso}}
: Time on ISO 8601 (Alias of{{iso8601}}
){{iso8601}}
: Time on ISO 8601{{utc}}
: Date in the RFC 7231 format (Alias of{{rfc7231}}
){{rfc7231}}
: Date in the RFC 7231 format{{time}}
: Result ofdate.getTime()
{{full_year}}
: Result ofdate.getFullYear()
{{utc_full_year}}
: Result ofdate.getUTCFullYear()
{{month}}
: Result ofdate.getMonth()
{{utc_month}}
: Result ofdate.getUTCMonth()
{{date}}
: Result ofdate.getDate()
{{utc_date}}
: Result ofdate.getUTCDate()
{{day}}
: Result ofdate.getDay()
{{utc_day}}
: Result ofdate.getUTCDay()
{{hours}}
: Result ofdate.getHours()
{{utc_hours}}
: Result ofdate.getUTCHours()
{{minutes}}
: Result ofdate.getMinutes()
{{utc_minutes}}
: Result ofdate.getUTCMinutes()
{{seconds}}
: Result ofdate.getSeconds()
{{utc_seconds}}
: Result ofdate.getUTCSeconds()
{{milliseconds}}
: Result ofdate.getMilliseconds()
{{utc_milliseconds}}
: Result ofdate.getUTCMilliseconds()
{{timezone_offset}}
: Result ofdate.getTimezoneOffset()
{{local}}
: Result ofIntl.DateTimeFormat.format
{{local_day}}
:day
part ofIntl.DateTimeFormat
{{local_dayPeriod}}
:dayPeriod
part ofIntl.DateTimeFormat
{{local_era}}
:era
part ofIntl.DateTimeFormat
{{local_hour}}
:hour
part ofIntl.DateTimeFormat
{{local_literal}}
:literal
part ofIntl.DateTimeFormat
{{local_minute}}
:minute
part ofIntl.DateTimeFormat
{{local_month}}
:month
part ofIntl.DateTimeFormat
{{local_second}}
:second
part ofIntl.DateTimeFormat
{{local_timeZoneName}}
:timeZoneName
part ofIntl.DateTimeFormat
{{local_weekday}}
:weekday
part ofIntl.DateTimeFormat
{{local_year}}
:year
part ofIntl.DateTimeFormat
{{YYYY}}
: Full year in local time. Ej.2023
.{{MM}}
: Month in local time. Ej.07
,12
.{{DD}}
: Day of month in local time. Ej.09
,31
.{{hh}}
: Hour in local time. Ej.06
,18
.{{mm}}
: Minute in local time. Ej.23
,59
.{{ss}}
: Second in local time. Ej.13
,30
.{{ms}}
: Millisecond in local time. Ej.0456
,998
.
Sample
ndate --template '{{utc_full_year}}-{{utc_month}}-{{utc_date}}' # 2023-6-13