Get the App
SLTechnology News&Howtos  ›  Servers  › 

Convert unix timestamp

Shulou Source: shulou.com Published: 2022-06-03 08:51:31 12月06日 Update

Convert unix timestamp to normal date format

Date-d '1970-01-01 UTC xxxxxxxxxx seconds' + "% F% T"

Displays the time of the current unix timestamp

Date +% s

For example:

# date

Thu Sep 20 18:02:28 CST 2007

# date

Thu Sep 20 18:02:40 CST 2007

# date +% s

1190282563

# date-d '1970-01-01 UTC 1190282563 seconds' + "% F% T"

2007-09-20 18:02:43

Today's 2.14, it's exactly 1234567890.

Date-d @ 1234567890

Perl-e'print scalar localtime (1234567890), "\ n";'

Multiple-v parameters can be specified at the same time, calculated in the specified order

Date-Vmur1m-V1d the first day of last month

Date-V1d-v-1D the last day of last month. The first day of this month minus one day is the last day of last month.

Date-vain 1m-v1d-vmur1d the last day of the month. The first day of next month minus one day is the last day of this month.

Tags: That is parameters simultaneous multiple time order. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn MySQL Xiaomi NVidia