Get Current date in epoch from Unix shell script

前端 未结 5 613
忘掉有多难
忘掉有多难 2020-12-23 12:53

How to get the current date value in epoch i.e., number of days elapsed since 1970-1-1. I need solution in unix shell script.

5条回答
  •  被撕碎了的回忆
    2020-12-23 13:54

    Depending on the language you're using it's going to be something simple like

    CInt(CDate("1970-1-1") - CDate(Today()))
    

    Ironically enough, yesterday was day 40,000 if you use 1/1/1900 as "day zero" like many computer systems use.

提交回复
热议问题