2014-03-13 63 views
0

使用任何perl的模塊(POSIX MKTIME),它可以是能夠將log4jtime戳轉換出至毫秒或任何外殼命令轉換log4j的時間戳通過unix命令毫秒

2014年3月12日18點11分: 47075 INFO BAS_Connector線程2 我想轉換2014年3月12日18:11:47075 =>毫秒

+0

是什麼「,075」爲? – sanooj

+0

檢查這個http://stackoverflow.com/questions/16548528/linux-command-to-get-time-in-milliseconds 你會得到毫秒參考時代號 – sanooj

+0

爲什麼「沒有任何Perl模塊」?你在問作業問題嗎?似乎不太可能。 你怕他們嗎?你知道POSIX :: mktime是一個核心內建的,因此你可以總是依靠它存在嗎? – LeoNerd

回答

0
date --date="2014-03-12 18:11:47,075" +%s --> will convert the given date string to epoch number 
    date --date="2014-03-12 18:11:47,075" +%s%N --> in Nanoseconds 
    1394662307075000000 
    date --date="2014-03-12 18:11:47,075" +%s%3N --> in milliseconds 
    1394662307075 

隱蔽這毫秒,檢查該SO後:Linux command to get time in milliseconds