Tag:get date

  • Get the date method for the last day of last month in the shell script

    Time:2019-7-2

    The date command is used in Linux to get the date of the last day of last month: $ date -d”`date +%Y%m01` last day” +%Y%m%d 20161231 Write the script getdate.sh: #! /bin/sh Nowdate = `date +% Y% M01 ` the first day of this month Startdate= `date-d’, $nowdate last month’, +% Y% m% D `\\\\\\\\\\ […]

  • Linux method to get the end-of-month date corresponding to a date

    Time:2019-6-21

    As follows: date -d”$(date -d’2016-03-19 1 month’ +’%Y-%m-01′) -1 days” +”%F” Analysis 1. First add a month to the given date and output the first day of that month. 2. One more day will give you the desired end-of-month date. Considering that variables cannot be plugged in single quotation marks, let’s change the way we […]

  • Perl and shell get the code for the date of yesterday, tomorrow or more days ago

    Time:2019-6-20

    First, how to get Perl Copy codeThe code is as follows: #!/usr/bin/perl -wuse POSIX qw(strftime);My $day = strftime (“% Y% m% D”, local time (time – 24 * 3600); Get the date of yesterday 2. The comparison of man date-d parameter in Linux is general. The following examples are further explained: # -d, –date=STRING display […]