Converting real time to epoch time

[root@ds-accm-z2-pri196 ~]# date +%s -d "Mon Feb 11 02:26:04"
1360567564
[root@ds-accm-z2-pri196 ~]# perl -e 'print scalar localtime(1360567564), "\n";'
Mon Feb 11 02:26:04 2013
 

the epoch conversion is working fine. but one of my application needs 13 digit epoch time as input

1359453135154

rather than 10 digit epoch time

1360567564

is there some conversion that i am missing? any help will be deeply appreciated. thanks

PS: in one of the epoch online conversion website i tried to convert both types of epoch time. both are working but in unix i am not able to convert into 13 digit output epoch time :frowning:

[

 
http://www.epochconverter.com/

](http://www.epochconverter.com/)

epoch 13 uses milliseconds instead of seconds, since you are not using the extra precision with your date command, why not try simply adding 3 zeroes at the end?

date +%s000 -d "Mon Feb 11 02:26:04"
1 Like

thanks mate it worked with my application :slight_smile:

Hi all,
Can any1 suggest me how can i get the epoch time of file.
i mean...
ls -l test.txt | awk '{print $6,""$7,""$8}' gives me Nov 30 2011...
now is there any way i can convert this into epoch time for this particular file only...
Thanks