How many minutes have passed since the Unix Epoch ? It should be January 1, 1970 ?

Let's say approximately until 1 Jan 2011... 5 865 696 000 minutes ?


# Minutes since Epoch until now:
((minutes=$(date +%s)/60))

# Minutes since Epoch until Jan 1 2011:
((minutes=$(date -d 'Jan 1 2011' +%s)/60))
  • 1
    The %s in date +%s is a GNU extension. Other implementations typically allow the same format strings as in strftime(3), which mostly don't have %s. And WHY do everybody assume bash availability? – MattBianco Mar 31 '11 at 6:41
  • Does this take leap seconds into account? – mattdm Mar 31 '11 at 15:51
  • 1
    @mattdm> From info date... %s "...Leap seconds are not counted unless leap second support is available." ... %S "second ('00'...60'). This may be '60' if leap seconds are supported." ... I can only assume that it would include those seconds in a total of 'seconds-since-epoch' when the support is available. – Peter.O Mar 31 '11 at 16:20
  • 1
    @mattbianco 1) i didn't necessarily "assume" bash availability. I provided my solution using bash. It doesn't have to be accepted by @patrick as the answer and you can provide your own solution. 2) When discussing Linux, it's almost certain that bash is available. I'd put my guess at about 99.9% likely given any random selection of Linux installations. 3) I use OSX and %s is available in BSD's date even though, in general, it's a significantly command than GNU's date. – nix Apr 1 '11 at 14:53

If you've got Python installed then you can run this:

python -c "import time; print time.time() / 60"

You can check the online version of Unix Epoch: Epoch Converter. You can get the current Epoch value and also convert time back to epoch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.