Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

how to read time reported by yarn

avatar
Super Collaborator

how can I convert this start and finish time to normal date format?

$ yarn application -status application_1517871817099_0015
Application Report :
        Application-Id : application_1517871817099_0015
        Application-Name : distcp
        Application-Type : MAPREDUCE
        Queue : default
        Application Priority : null
        Start-Time : 1517874876754
        Finish-Time : 1517875501288
        Progress : 100%
        State : KILLED
        Final-State : KILLED
1 ACCEPTED SOLUTION

avatar
Super Collaborator

ok I found three ways to convert correctly the milliseconds unix time to human readable time format

mysql> select from_unixtime(floor(1517874876754/1000));
+------------------------------------------+
| from_unixtime(floor(1517874876754/1000)) |
+------------------------------------------+
| 2018-02-05 18:54:36                      |
+------------------------------------------+
1 row in set (0.00 sec)

$ awk '{print strftime("%c", ( 1517874876754 + 500 ) / 1000 )}'
Mon 05 Feb 2018 06:54:37 PM EST

$ date -d @$(  echo "(1517874876754+ 500) / 1000" | bc)
Mon Feb  5 18:54:37 EST 2018


View solution in original post

2 REPLIES 2

avatar
Super Collaborator

I found two methods online which gives different results , which one is correct ?

$ date -d @1517874876754
Tue Jul 16 02:12:34 EDT 50069
mysql> select from_unixtime(floor(1517875501288/1000));
+------------------------------------------+
| from_unixtime(floor(1517875501288/1000)) |
+------------------------------------------+
| 2018-02-05 19:05:01                      |
+------------------------------------------+

avatar
Super Collaborator

ok I found three ways to convert correctly the milliseconds unix time to human readable time format

mysql> select from_unixtime(floor(1517874876754/1000));
+------------------------------------------+
| from_unixtime(floor(1517874876754/1000)) |
+------------------------------------------+
| 2018-02-05 18:54:36                      |
+------------------------------------------+
1 row in set (0.00 sec)

$ awk '{print strftime("%c", ( 1517874876754 + 500 ) / 1000 )}'
Mon 05 Feb 2018 06:54:37 PM EST

$ date -d @$(  echo "(1517874876754+ 500) / 1000" | bc)
Mon Feb  5 18:54:37 EST 2018