Hello
I want to get end date of the any month in unix . is there any function to do this.
we can get month from date command 'date +%b'
example:
If Feb month then last date is 28
if sep then last date 30. like this
thanks
please help (12 Replies)
I have looked through the forums and found many date / time manipulation tools, but cannot seem to find something that fits my needs for the following.
I have a log file with date time stamps like this:
Jun 21 17:21:52
Jun 21 17:24:56
Jun 21 17:27:59
Jun 21 17:31:03
Jun 21 17:34:07
Jun... (0 Replies)
Hi,
I'm a newbie to unix and i'm loving every bit of it.
I need assistance in setting my date function in my script to "new month".
What I want to do is define the "newmonth" as the 1st of every month so my script can run by this time evry month through the year.
Can someone assist.
... (1 Reply)
how can we add or subtract days from the output of date command in unix...
like if i want to subtract a day from the result of date command like this..
v_date=`date +%Y%m%d`
this wud give me 20080519
now i want to subtract one day from this.. so tht it wud give me 20080518..
how do i do... (1 Reply)
I got a statement like below to subtract 1 from given date using teradata. I am looking for a one line unix command to perform the same.
select 'parse_this_record', (DATE '${FILE_DATE}' - 1) (FORMAT 'YYYY-MM-DD');
Input: 2012-02-21
Expected Output: 2012-02-20
PS: One liner because I am... (2 Replies)
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)
Hi All,
I am getting a date from environment variable and want to do some processing by subtracting 2 months from the date passed through the environment variable.
I am trying the following syntax :
date_var=2014-08-31
date_2M_ago='$date_var+"%d%m%y" --$date_var="2 months ago" '... (3 Replies)
Hi All,
I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies
LEARN ABOUT PHP
datetime.setisodate
DATETIME.SETISODATE(3) 1 DATETIME.SETISODATE(3)DateTime::setISODate - Sets the ISO date
Object oriented style
SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1])
DESCRIPTION
Procedural style
DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1])
Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3). The function modifies this object.
o $year
- Year of the date.
o $week
- Week of the date.
o $day
- Offset from the first day of the week.
RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | Changed the return value on success from NULL to |
| | DateTime. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
DateTime.setISODate(3) example
Object oriented style
<?php
$date = new DateTime();
$date->setISODate(2008, 2);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "
";
?>
Procedural style
<?php
$date = date_create();
date_isodate_set($date, 2008, 2);
echo date_format($date, 'Y-m-d') . "
";
date_isodate_set($date, 2008, 2, 7);
echo date_format($date, 'Y-m-d') . "
";
?>
The above examples will output:
2008-01-07
2008-01-13
Example #2
Values exceeding ranges are added to their parent values
<?php
$date = new DateTime();
$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 2, 8);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 53, 7);
echo $date->format('Y-m-d') . "
";
?>
The above example will output:
2008-01-13
2008-01-14
2009-01-04
Example #3
Finding the month a week is in
<?php
$date = new DateTime();
$date->setISODate(2008, 14);
echo $date->format('n');
?>
The above examples will output:
3
SEE ALSO DateTime.setDate(3), DateTime.setTime(3).
PHP Documentation Group DATETIME.SETISODATE(3)