Epoch Converter and Date/Time in BASH

Quick Navigation

Getting Current Date and Time



    #current unix time
    date +"%s"

    #current date
    date

    #current date but -u gives the UTC
    date -u
                

Output:



    1550546691
    Tue Feb 19 03:24:51 UTC 2019
    Tue Feb 19 03:24:51 UTC 2019

                


From Unix Time to Date



    #from unix time to date
    date -d @1550014601

                

Output:



    Tue Feb 12 23:36:41 UTC 2019

                


From Date to Unix Time



    #from date to unix time
    date -d '02/12/2019 00:00:00' +"%s"

                

Output:



    1549929600

                


Programming Languages: