somehost [0] timetrans.pl -h
timetrans.pl translates between UNIX epoch time and normal date/time formats, optionally accepting either as input as well as the use of modifiers to further adjust the resulting time. Usage: timetrans.pl [-h|H] timetrans.pl [-v] timetrans.pl [-d|-e] [-l|-u] [-s] [-t (+|-)time] [SECONDS|[yyyy/mm/dd@HH:MM:SS|yyyy/mm/dd HH:MM:SS]] -h This help output. -H Sample usage examples. -v Display timetrans.pl version and exit -d Force output to only normal data/time format; mutually exclusive of -e; if set, -s is ignored (optional) -e Force output to only epoch time format; mutually exclusive to -d; if set, -s is ignored (optional) -l Output time in localtime; mutually exclusive to -u (default) -u Output time in UTC; mutually exclusive to -l (optional) -s Short output; returns only the translated value; ignored if either -e or -d are set; if TIME value is not set, short output defaults to date/time format (optional) -t Modify time by (+|-) time; accepts values of seconds or increment multipliers of (s|m|h|d|w) wherein +3w2d1h5m20s would add a multiplier of 3 weeks, 2 days 1 hour, 5 minutes, and 20 seconds to the time value; if no multiplier, the value is considered to be seconds; if no (+|-), the value is added (optional) TIME Input time value of SECONDS from 1970/01/01 00:00:00 UTC (UNIX epoch) or as a normalized local date/time formatted either as 'yyyy/mm/dd@HH:MM:SS' or 'yyyy/mm/dd HH:MM:SS'; if not specified, current time is used; can be a negative value, however it must be preceded by flag '--'; TIME input can also be piped to timetrans.pl (optional) somehost [10] timetrans.pl -H timetrans.pl sample usage examples. For option descriptions, please see: 'timetrans.pl -h' EXAMPLES: Display version: somehost [0] timetrans.pl -v timetrans.pl version: v0.1.1 No parameters or time input: somehost [0] timetrans.pl 2012/03/29 00:38:12 -0400 UNIX time: 1332995892 Using a negative time modifier with epoch time: somehost [0] timetrans.pl -t-1d37m 1280550076 2010/07/29 23:44:16 -0400 UNIX time: 1280461456 Using normalized local date/time input: somehost [0] timetrans.pl 2010/07/31 00:21:16 2010/07/31 00:21:16 -0400 UNIX time: 1280550076 Using normalized local date/time piped input: somehost [0] echo "2010/07/31:21:16" | timetrans.pl 2010/07/31 00:21:16 -0400 UNIX time: 1280550076 Using piped data/time input and requesting short output: somehost [0] echo "2010/07/31 00:21:16" | timetrans.pl -s 1280550076 Using epoch time input and requesting short output: somehost [0] timetrans.pl -s 1280550076 2010/07/31 00:21:16 -0400 Using piped epoch time input with a time modifier and epoch time output: somehost [0] echo "1280550076" | timetrans.pl -t +2w3d4m5 -e 1282019121 Using a time modifier with local date/time input: somehost [0] timetrans.pl -t86400 2010/08/18 00:25:21 2010/08/19 00:25:21 -0400 UNIX time: 1282191921 Using a negative time modifier with time/date input and time/date output: somehost [0] timetrans.pl -d -t -86400 2010/08/18 00:25:21 2010/08/17 00:25:21 -0400 Using a time modifier with local time/date input and UTC time/date output: somehost [0] timetrans.pl -d -u -t86400 2010/08/18 00:25:21 2010/08/19 00:25:21 UTC Using a negative epoch time input: somehost [0] timetrans.pl -- -1282191921 1929/05/15 15:34:39 -0400 UNIX time: -1282191921 somehost [9]
01 April 2012
new utility: timetrans.pl
I've posted a new utility, timetrans.pl, to the Tools page. The following are both the "help" and "sample usage output" for timetrans.pl:
Labels:
blog info