I find only this program
http://www.clickbay.de/win/unix-time-stamp-command-line-tool.htm
which only convert timestamp to readable time but not vice versa.
I think about output of "date /t" and "time /t", but the "time /t" does
not provide seconds.
At this time I am use the perl script
http://bbs.loewen.com.sg/viewtopic.php?p=4871
but this require perl installation, thus admin rights :-(
L.
%time% variable provides seconds.
But you are right, it is difficult enough to calculate a difference in
time. I even would tell that is tiresome.
> Anybody know if exist win32 shell script (or .exe app) generate unix
> timestamp?? http://en.wikipedia.org/wiki/Unix_time
>
<snip>
>
> At this time I am use the perl script
> http://bbs.loewen.com.sg/viewtopic.php?p=4871 but this require perl
> installation, thus admin rights :-(
You can use gawk - it doesn't require installation, only that the EXE and
DLLs be present and accessible. It has strftime() which can be formatted
any way you like. You can even make it shift time zones by giving it a
systime() argument with 60*60 seconds added or subtracted for each 1 hour
shift. http://gnuwin32.sourceforge.net/packages/gawk.htm
One of the earlier versions had a Windows help file in the documentation
package. Use the binaries and documentation zip files instead of the
setup package.
--
Ted Davis (tda...@mst.edu)
Maybe Ritchie Lawrence's DateToSecs function does most of what you
want?
http://www.commandline.co.uk/lib/treeview/index.php
and click on 'Batch Function Library' then on "Date and Time
Functions'.
"Returns number of seconds elapsed since 1st January 1970 00:00:00 for
a given calendar date and time of day." which can of course be
'now'....
>Anybody know if exist win32 shell script (or .exe app) generate unix
>timestamp?? http://en.wikipedia.org/wiki/Unix_time
16-bit NOWMINUS, via sig line 3, can do that but taking thr local time
to be UTC.
32-bit TZ-CHECK does that; you would need to select the appropriate part
of the appropriate line of standard output - COLS, from the same place,
can do that.
<URL:http://www.merlyn.demon.co.uk/batfiles.htm#WSH>, and down to
subheading "JavaScript in WSH" shows how to see UTC date/time; replace
new Date().toUTCString() with +new Date() and you should get
UNIX time in milliseconds. Then Math.floor(new Date()/1000) gives
it in seconds.
I think all systems Win32 have by default WSH with JavaScript and
VBScript; often worth using if simple pure batch is not enough.
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.