Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

unix timestamp batch wanted

698 views
Skip to first unread message

Petr Laznovsky

unread,
Sep 28, 2010, 5:21:42 AM9/28/10
to
Anybody know if exist win32 shell script (or .exe app) generate unix
timestamp?? http://en.wikipedia.org/wiki/Unix_time

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.

01MDM

unread,
Sep 28, 2010, 7:12:05 AM9/28/10
to
> but the "time /t" does not provide seconds.

%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.

Ted Davis

unread,
Sep 28, 2010, 10:17:20 AM9/28/10
to
On Tue, 28 Sep 2010 11:21:42 +0200, Petr Laznovsky wrote:

> 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)

John Gray

unread,
Sep 28, 2010, 11:45:34 AM9/28/10
to
On 28 Sep, 10:21, Petr Laznovsky <nob...@nowhere.com> wrote:
> Anybody know if exist win32 shell script (or .exe app) generate unix
> timestamp??http://en.wikipedia.org/wiki/Unix_time
>
> I find only this programhttp://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 scripthttp://bbs.loewen.com.sg/viewtopic.php?p=4871

> but this require perl installation, thus admin rights :-(
>
> L.

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'....

Petr Laznovsky

unread,
Sep 28, 2010, 6:36:03 PM9/28/10
to
That`s exactly what I am looking for! Thanks!

Dr J R Stockton

unread,
Sep 29, 2010, 3:37:18 PM9/29/10
to
In alt.msdos.batch.nt message <i7sc35$2b3p$1...@ns.felk.cvut.cz>, Tue, 28
Sep 2010 11:21:42, Petr Laznovsky <nob...@nowhere.com> posted:

>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.

Message has been deleted

zbin...@gmail.com

unread,
Sep 19, 2015, 12:40:52 AM9/19/15
to
you can try this free online timestamp converter(http://www.online-code.net/unix-timestamp.html) to get a unix time.
0 new messages