Echodate

Submit command line tools that you find here.
Post Reply
Message
Author
User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

Echodate

#1 Post by Cornflower »

Good for renaming files via script or batch file, [Echodate](http://codefromthe70s.org/cmdline.aspx#echodate) is an executable wrapper around the strftime(), which has many date / time formats

It echos the current date or time to STDOUT or to redirection via > or |
In my scripts I usually send it to the clipboard via | clip and make the date available for other processing or use.

Syntax:
Echodate [strftime format] [[+|-]Diff-in-seconds]

If run without parameters, defaults to %y%m%d (yymmdd)

strftime format:

%a Weekday as locale’s abbreviated name. Mon
%A Weekday as locale’s full name. Monday
%w Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. 1
%d Day of the month as a zero-padded decimal number. 30
%-d Day of the month as a decimal number. (Platform specific) 30
%b Month as locale’s abbreviated name. Sep
%B Month as locale’s full name. September
%m Month as a zero-padded decimal number. 09
%-m Month as a decimal number. (Platform specific) 9
%y Year without century as a zero-padded decimal number. 13
%Y Year with century as a decimal number. 2013
%H Hour (24-hour clock) as a zero-padded decimal number. 07
%-H Hour (24-hour clock) as a decimal number. (Platform specific) 7
%I Hour (12-hour clock) as a zero-padded decimal number. 07
%-I Hour (12-hour clock) as a decimal number. (Platform specific) 7
%p Locale’s equivalent of either AM or PM. AM
%M Minute as a zero-padded decimal number. 06
%-M Minute as a decimal number. (Platform specific) 6
%S Second as a zero-padded decimal number. 05
%-S Second as a decimal number. (Platform specific) 5
%f Microsecond as a decimal number, zero-padded on the left. 000000
%z UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).
%Z Time zone name (empty string if the object is naive).
%j Day of the year as a zero-padded decimal number. 273
%-j Day of the year as a decimal number. (Platform specific) 273
%U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 39
%W Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 39
%c Locale’s appropriate date and time representation. Mon Sep 30 07:06:05 2013
%x Locale’s appropriate date representation. e.g. 09/30/13
%X Locale’s appropriate time representation. e.g. 07:06:05
%% A literal '%' character. %

Diff-in-seconds
Echodate can alter the output by +seconds or -seconds (+ is the default if the sign is not included)


Syntax: Echodate %#formatletter
If the #modifier is used, some format letters are modified, thus

%#x Long date, according to the current locale
%#c Long date and time, according to the current locale

%#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y
Remove leading zeros (if any).

Play with the different format letters as your locale may be different than mine.
Last edited by Cornflower on Tue Nov 03, 2020 9:02 am, edited 1 time in total.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

Re: Echodate batch file tool

#2 Post by vevy »

You started already! Cool!

Side note: could you edit the title so it reads "command line tool" or even just "utility" so something? Because at first I thought it was about a batch file!

Thanks and looking forward to more!

Post Reply