I need something simple like date
, but in seconds since 1970 instead of the current date, hours, minutes, and seconds.
date
doesn't seem to offer that option. Is there an easy way?
long epoch = System.currentTimeMillis()/1000; Returns epoch in seconds.
how can I get the current standard epoch time (seconds from 1970) in a shell script? I know I could do this with a bit of perl of even c++ but i want to do it in Bourne shell..... date +%s should give you that. date +%s should give you that.
time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). If t is non-NULL, the return value is also stored in the memory pointed to by t.
This should work:
date +%s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With