Get the App
SLTechnology News&Howtos  ›  Development  › 

Shell implements the code to judge the year according to the date, month and week.

Shulou Source: shulou.com Published: 2022-06-03 16:29:17 11月14日 Update

This article mainly explains "the code of Shell to judge the year according to the date, month and week". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Shell implementation based on the date, month, week to judge the year of the code" it!

Three time variables are known:

Time1= "Fri Aug 23 11:35:21"

Time2= "Mon Sep 2 16:18:09"

Time3= "Tue Sep 3 16:06:33"

It is known that these three times can be determined to occur in 2011-2013, how to quickly determine which year?

Want to output:

Time1= "11:35:21 on 2013-8-23"

Time2= "16:18:09 on 2013-9-2"

Time3= "16:06:33 on 2013-9-3"

#! / bin/bashtime1= "Fri Aug 23 11:35:21" time2= "Mon Sep 2 16:18:09" time3= "Tue Sep 3 16:06:33" time4= "Sun Dec 2 16:06:34" for

Tags: Code year date week month three content time learning practical deeper interest variable practical practical easy to operate method more friends website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn MariaDB Xiaomi MySQL