09-29-2008
Date Calculation
Hi experts,
Can you please help me in calculating the future date using unix shell scripting..
for example
lets say todays date is 29-sep-2008
i wanna calculate the date after 365 days...
hence the date must be 29-sep-2009..
Quick response is appreciable.
thanks in advance..
subhendu
10 More Discussions You Might Find Interesting
1. Programming
Hi
One of my vendor based tool is giving date in
no. of days since 1900-01-01.
So, I want to display in CCYYMMDD format.
For ex:- Vendor based tool is giving as 38790 days since 1900-01-01
corresponding to12/sep/2006
Does anybody has the... (1 Reply)
Discussion started by: axes
1 Replies
2. UNIX for Advanced & Expert Users
Hi all,
i need a script that can check if users did an operation within 3 days,if not delete all the logs of users who did not perform any activity after 3 days.therefore script should be able to use current date and verify last date user performed activity and see if it is greater or less than 3... (3 Replies)
Discussion started by: tomjones
3 Replies
3. Shell Programming and Scripting
Hello all. I'm writing a script that should work with some files being sure that them were created a concrete day (0, 1, 2 or 3 days before script execution). This task should be done under Solaris and Linux hosts with different versions (Solaris 8, 9 and 10, Suse 9 and 10) so I'm trying to make... (3 Replies)
Discussion started by: nefeli
3 Replies
4. Shell Programming and Scripting
hello guys,
I had been to many forums and many topics in this site as well for my question but did not get any solution.
My question is how i can get y'day date with time stamp
today is 20100729103819 and i am looking for output as 20100728103819.
in simple words as we do in oracle sysdate-1... (4 Replies)
Discussion started by: lokaish23
4 Replies
5. Shell Programming and Scripting
hello!
I need a date calculation script that need to do that:
./date.sh 20090312
and the script need to give me which day is it for example monday friday or what else!
can anyone help me?? its really urgent :S thx the help! (7 Replies)
Discussion started by: impish
7 Replies
6. Shell Programming and Scripting
I have to run a shell , only if file_a.txt is updated correctly before 1hr.
that is,
file_a.txt
2011_09_21__14:10:20 --> any format..
And
the shell can be like,
if ; then
Run some shell
update file_a.txt with (date now)
fi
how to do this ? (6 Replies)
Discussion started by: linuxadmin
6 Replies
7. Shell Programming and Scripting
Hello eveyone, I am tasked to write an (n)awk script to calculate the days between dates. Now before anyone chastizes me on how many forums there are on date calculation, I have no seen one that takes into account the Julian calender as well. As most know, September of 1752 is when we (the US)... (2 Replies)
Discussion started by: csharp100
2 Replies
8. Shell Programming and Scripting
Hi
I have this date 11:30:02-31.11.12
How to calculate date between this date and now?
I like it printed like this:
31D 2H 1M
if possible. (6 Replies)
Discussion started by: Jotne
6 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I need to calculate the date for monday to friday.
Say today is 10.oct.2014 then I need to calculate the date as 09.oct.2014.
If today is 13.oct.2014 then I need to calculate the date as 10.oct.2014.
If its 03.Nov.2014 then date calculated must be 31.oct.2014.
Please help in in... (2 Replies)
Discussion started by: abhi_123
2 Replies
10. UNIX for Dummies Questions & Answers
I want to automate change in 'from yyyy/mm/dd to yyyy/mm/dd' every month in a unix program.
For example in this month 'from yyyy/mm/dd to yyyy/mm/dd' is 'from 2014/10/01 to 2014/11/01' next month it should be 'from 2014/11/01 to 2014/12/01'
Can any one provide me the code for the above... (2 Replies)
Discussion started by: srinivas kasett
2 Replies
LEARN ABOUT PHP
easter_date
EASTER_DATE(3) 1 EASTER_DATE(3)
easter_date - Get Unix timestamp for midnight on Easter of a given year
SYNOPSIS
int easter_date ([int $year = date("Y")])
DESCRIPTION
Returns the Unix timestamp corresponding to midnight on Easter of the given year.
Warning
This function will generate a warning if the year is outside of the range for Unix timestamps (i.e. before 1970 or after 2037).
The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the
Spring Equinox. The Equinox is assumed to always fall on 21st March, so the calculation reduces to determining the date of the full moon
and the date of the following Sunday. The algorithm used here was introduced around the year 532 by Dionysius Exiguus. Under the Julian
Calendar (for years before 1753) a simple 19-year cycle is used to track the phases of the Moon. Under the Gregorian Calendar (for years
after 1753 - devised by Clavius and Lilius, and introduced by Pope Gregory XIII in October 1582, and into Britain and its then colonies in
September 1752) two correction factors are added to make the cycle more accurate.
PARAMETERS
o $year
- The year as a number between 1970 an 2037. If omitted, defaults to the current year according to the local time.
RETURN VALUES
The easter date as a unix timestamp.
EXAMPLES
Example #1
easter_date(3) example
<?php
echo date("M-d-Y", easter_date(1999)); // Apr-04-1999
echo date("M-d-Y", easter_date(2000)); // Apr-23-2000
echo date("M-d-Y", easter_date(2001)); // Apr-15-2001
?>
NOTES
Note
easter_date(3) relies on your system's C library time functions, rather than using PHP's internal date and time functions. As a con-
sequence, easter_date(3) uses the TZ environment variable to determine the time zone it should operate in, rather than using PHP's
default time zone, which may result in unexpected behaviour when using this function in conjunction with other date functions in
PHP.
As a workaround, you can use the easter_days(3) with DateTime and DateInterval to calculate the start of Easter in your PHP time
zone as follows:
<?php
function get_easter_datetime($year) {
$base = new DateTime("$year-03-21");
$days = easter_days($year);
return $base->add(new DateInterval("P{$days}D"));
}
foreach (range(2012, 2015) as $year) {
printf("Easter in %d is on %s
",
$year,
get_easter_datetime($year)->format('F j'));
}
?>
The above example will output:
Easter in 2012 is on April 8
Easter in 2013 is on March 31
Easter in 2014 is on April 20
Easter in 2015 is on April 5
SEE ALSO
easter_days(3) for calculating Easter before 1970 or after 2037 .
PHP Documentation Group EASTER_DATE(3)