Tuesday, June 2, 2015

milliseconds to date

Most of the java apps use milliseconds, here is bash date for getting the date for the same


## Current system date

$ date
Tue Jun  2 08:07:57 UTC 2015

## Epoch system date
$ date +"%s"
1433232485

## Milliseconds for the date
$ date +"%s%3N"
1433232489392

## Last 3 digits are for millisecs, so put decimal point and you get the get
$ date -d @"1433232489.392"

Tue Jun  2 08:08:09 UTC 2015


## or strip of Last 3 digits

$ date -d @"1433232489"

Tue Jun  2 08:08:09 UTC 2015