0

with out using any perl module (POSIX MKTIME) can it be possible to convert the log4jtime stamp to millisecond or any shell command

2014-03-12 18:11:47,075 INFO BAS_Connector-thread-2 I want to convert 2014-03-12 18:11:47,075 =>millisecond

  • check this http://stackoverflow.com/questions/16548528/linux-command-to-get-time-in-milliseconds You will get the millisenconds with reference to epoch number – sanooj Mar 13 '14 at 06:04
  • Why "without any perl module"? Are you asking a homework question? Seems unlikely. Are you afraid of them? Are you aware that POSIX::mktime is a core builtin and thus you can always rely on it existing? – LeoNerd Mar 13 '14 at 14:11

1 Answers1

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

to covert this to milliseconds,check this SO post: Linux command to get time in milliseconds

Community
  • 1
  • 1
sanooj
  • 493
  • 5
  • 12