How do I get the current Unix time in milliseconds in Bash?

This:

date +%s 

will return the number of seconds since the epoch.

This:

date +%s%N

returns the seconds and current nanoseconds.

So:

date +%s%N | cut -b1-13

will give you the number of milliseconds since the epoch – current seconds plus the left three of the nanoseconds.


and from MikeyBecho $(($(date +%s%N)/1000000)) (dividing by 1000 only brings to microseconds)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)