gdate

Display the current date and time in the GNU date compatible format

Command line options

FORMATg_date +"FORMAT"Result
\can be used instead of %
\\a literal \\
%%a literal %%
%alocale's abbreviated weekday nameSun
%Alocale's full weekday nameSunday
%blocale's abbreviated month nameFeb
%Blocale's full month nameFebruary
%clocale's date and timeThu Mar 3 23:05:25 2005
%Ccentury; like %Y, except omit last two digits20
%dday of month26
%Ddate; same as %m/%d/%y02/26/22
%eday of month, space padded; same as %_d 2
%Ffull date; same as %Y-%m-%d2022-02-26
%glast two digits of year of ISO week number (see %G)22
%Gyear of ISO week number (see %V); normally useful only with %V2022
%hsame as %bFeb
%Hhour (00..23)11
%Ihour (01..12)23
%jday of year (001..366)073
%khour, space padded  0-23; same as %\_H 7
%lhour, space padded  1-12; same as %\_I 7
%mmonth (01..12)02
%Mminute (00..59)22
%na newline\n
%Nnanoseconds (000000000..999999999)000000000
%plocale's equivalent of either AM or PM; blank if not knownAM
%Plike %p, but lower caseam
%qquarter of year (1..4)1
%rlocale's 12-hour clock time11:22:33 PM
%R24-hour hour and minute; same as %H:%M23:22
%sseconds since 1970-01-01 00:00:00 UTC1647282830
%Ssecond (00..60)33
%ta tab\t
%Ttime; same as %H:%M:%S23:22:33
%uday of week (1..7); 1 is Monday1
%Uweek number of year, with Sunday as first day of week (00..53)11
%VISO week number, with Monday as first day of week (01..53)11
%wday of week (0..6); 0 is Sunday1
%Wweek number of year, with Monday as first day of week (00..53)11
%xlocale's date representation03/14/22
%Xlocale's time representation20:36:30
%ylast two digits of year22
%Yyear2022
%z+hhmm numeric time zone+0000
%:z+hh:mm numeric time zone+00:00
%::z+hh:mm:ss numeric time zone+00:00:00
%:::znumeric time zone with : to necessary precision+00, +00:00
%Zalphabetic time zone abbreviation (e.g., EDT)GMT
FORMATg_date FORMATResult
dSt2022-02-26 11:22
ddate2022-02-26
ttime11:22
ltime long11:22:33
.use . as a separator
Sspace
TTAB
Nnew line
?help

Sample use

g_date +"%Y-%m-%d"  # 2022-02-26  # GNU date compliant format
g_date d            # 2022-02-26  # simple format

Supported Platforms

☂︎ Windows

Prerequisites and build instructions

© 2023 Georgi Valkov

https://httpstorm.com/download/windows/g_date/