Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to get first & last day of a month from current date? Post 303041727 by RudiC on Monday 2nd of December 2019 04:45:18 PM
Old 12-02-2019
Did you look into the helpful links at the bottom of this page under "10 More Discussions You Might Find Interesting"?



Howsoever, for your first question, try


Code:
$ date --date='07/20/2019' +"%Y-%m-01"
2019-07-01

, and for the second,



Code:
$ date -d"$(date --date='07/20/2019 +1month' +"%Y-%m-01") -1sec" +%F
2019-07-31

These 3 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete files one day old in current month only

i want to delete files that are one day old condition is files should be of current month only ie if iam running script on 1 march it should not delete files of 28 feb(29 if leap year :-)} any modifications to find $DIR -type f -atime +1 -exec rm -f{}\; (4 Replies)
Discussion started by: maverick
4 Replies

2. Shell Programming and Scripting

single digit for day and month on date

hi all, how do i format the date command so it displays day and month in single digits i.e 8 instead of 08 ?? am using the command (in a ksh) : date +%D output i get is 10/08/08 thanks in advance. (5 Replies)
Discussion started by: cesarNZ
5 Replies

3. Shell Programming and Scripting

needs to display month for previous day date

Hello, I wanted to display the month for previous day date. Like, today date is 18-Nov-2008. So the previous date is 17-Nov-2008. The output should be November. If the today date is 1-DEC-2008, then output should be NOVEMBER. If the today date is 1-JAN-2008, then output should be DECEMBER.... (4 Replies)
Discussion started by: govindts
4 Replies

4. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

5. Shell Programming and Scripting

current date - one month in AIX

Hi, i unable to get the last month date in AIX. current date - one month Based on the forums tried but did not find the relevent information. Any help grealy appriciated. Thanks Suri. (3 Replies)
Discussion started by: onesuri
3 Replies

6. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

7. Shell Programming and Scripting

Help with getting last date of previous month and first date of previous 4th month from current date

I have requirment to get last date of previous month and the first date of previous 4th month: Example: Current date: 20130320 (yyyymmdd) Last date of previous month: 20130228 (yyyymmdd) First date of previous 4th month: 20121101 (yyyymmdd) In my shell --date, -d, -v switches are not... (3 Replies)
Discussion started by: machomaddy
3 Replies

8. AIX

AIX - Get next month from current date

As said in object, how can i obtain that? In linux i use date -d "1 month" +"%m%Y". Thanks i advance. (8 Replies)
Discussion started by: fabfisc
8 Replies

9. Homework & Coursework Questions

How to minus 2 month from current date?

I am running a script in ksh to get the 2 months back date from system date.The below code is giving correct date output from putty command prompt.But while running the script is .ksh file it is giving the error below.Please suggest. ; d=a; y=a m-=num while(m < 1) {m+=12; y--}... (1 Reply)
Discussion started by: hini
1 Replies

10. UNIX for Beginners Questions & Answers

Replace date in file every day with current date

I Have text like XXX_20190908.csv.gz need to replace Only date in this format with current date every day Thanks! (1 Reply)
Discussion started by: yamasani1991
1 Replies
libexslt(4)						     Kernel Interfaces Manual						       libexslt(4)

NAME
libexslt - extension library for XSLT DESCRIPTION
The libexslt library is used to provide extensions to XSLT functions. These extensions come from the EXSLT project (http://www.exslt.org/) CALLING
To make use of these functions XSLT, these need to be declared with the proper name space SUPPORTED FUNCTIONS
COMMON Namespace: http://exslt.org/common node-set() convert the given RTF into a node-set object-type() returns the type of the given argument document() Create multiple output documents. See http://www.exslt.org/exsl/elements/document/index.html MATH Namespace: http://exslt/math For a description see http://www.exslt.org/math/index.html min() returns the minimum value of the given node-set max() returns the maximum value of the given node-set highest() returns the nodes in the node-set whose value is the maximum value for the node-set. lowest() returns the nodes in the node-set whose value is the minimum value for the node-set. constant() returns a number value of the given constant with the given precision. The constants are PI, E, SQRRT2, LN2, LN10, LOG2E, and SQRT1_2. random() returns a random number between 0 and 1 inclusive. abs() returns the absolute value of the argument. sqrt() returns the square root of the argument. power() returns the power base and power arguments. log() returns the natural log of the argument. sin() returns the sine of the argument. cos() returns the cosine of the argument. tan() returns the tangent of the argument. asin() returns the arc sine of the argument. acos() returns the arc cosine of the argument. atan() returns the arc tangent of the argument. atan2() returns the arc tangent function of the y/x arguments. exp() returns the exponential function of the argument. SETS Namespace http://exslt.org/sets For a description see http://www.exslt.org/set/index.html difference() returns the difference between the two given node-sets. intersection() returns a node-set of the nodes within both given node-sets. distinct() returns a node-set of all nodes in the first argument that are not in the seconds argument. has-same-node() returns TRUE if there is an intersection between the two given node-sets. leading() returns a node-set of all nodes in the first argument that precede the first node in the second argument. trailing() returns a node-set of all nodes in the first argument that follow the first node in the second argument. DATES and TIMES Namespace http://exslt.org/date-and-times For a description see http://www.exslt.org/date/date.html date-time() returns the current date and time as a date/time string. date() returns the date specified in the given date/time string. time() returns the time specified in the date/time string given as the argument. year() returns the year of a date as a number. leap-year() returns true if the year given in a date is a leap year. month-in-year() returns the month of a date as a number. month-name() returns the full name of the month of a date. month-abbreviation() returns the abbreviation of the month of a date. week-in-year() returns the week of the year as a number. week-in-month() returns the week in a month of a date as a number. day-in-year() returns the month of a date as a number. day-in-month() returns the day of a date as a number. day-in-week-in-month() returns the day-of-the-week in a month of a date as a number. day-in-week() returns the day of the week given in a date as a number. day-name() returns the full name of the day of the week of a date. day-abbreviation() returns the abbreviation of the day of the week of a date. hour-in-day() returns the hour of the day as a number. minute-in-hour() returns the minute of the hour as a number. second-in-minute() returns the second of the minute as a number. seconds() returns the number of seconds specified by the argument string. add() returns the date/time resulting from adding a duration to a date/time. add-duration() returns the duration resulting from adding two given durations together. difference() returns the duration between the first date and the second date. duration() returns a duration string that represents the given number of seconds since 1970-01-01T00:00:00. STRINGS Namespace http://exslt.org/strings For a description see http://www.exslt.org/str/index.html tokenize() returns a node set of token elements, each containing one token from the string. padding() returns a string padded to a certain length. align() returns a string aligned within another string. concat() returns the concatenation of the string values of the nodes in that node set. FUNCTIONS Namespace http://exslt.org/functions For a description see http://www.exslt.org/func/index.html function() declares an extension function. result() returns the result of an extension function declared in function(). FILES /usr/lib/libexslt.a static library /usr/lib/libexslt.so sharable library AUTHORS
Manual page by Heiko W. Rupp (hwr@pilhuhn.de) SEE ALSO
libxslt(3), libxml(3), xsltproc(1), xmllint(1) 15 May 2002 libexslt(4)
All times are GMT -4. The time now is 08:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy