Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Command to print previous year in UNIX Post 302914619 by Pradeep_1990 on Wednesday 27th of August 2014 02:32:10 AM
Old 08-27-2014
Or u can also use

HTML Code:
date --date='1 year ago' +%Y
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

previous,next command in unix

Hi , after pressing down arrow,up arrow I want to find previous,next command in unix wat can i do for tat plz tell me I am accesing unix server thru telnet. my shell prompt ksh (4 Replies)
Discussion started by: arulkumar
4 Replies

2. UNIX for Dummies Questions & Answers

Repeat previous unix command

Hi all, Is there a way to bring back the previous unix command without retyping? I tried the "arror up" key, and it seems not working (sun solaris). What is the correct way? Thanks! (4 Replies)
Discussion started by: syang68
4 Replies

3. Shell Programming and Scripting

Referring from the print of the previous command

Hi, I am a newbie in SHell Programming. I want to ask something about referring the result of the previous command in Shell-Prog. For example : bnm@dsds~> ifconfig eth0 Link encap:Ethernet HWaddr 00:0B:CD:85:A5:8A inet addr:192.168.0.2 Bcast:192.168.0.225 Mask... (2 Replies)
Discussion started by: bobb
2 Replies

4. Shell Programming and Scripting

how Print previous line ..........

HELLO...I wanted to ask you, than sure know unix more than me, as I can obtain the following solution: I have a file with rows of the type: CIAO COME STAI PERCHE COME STAI CIAO COME VA ALLO CHE FACCIAMO ................. I would that if in a line is present the word (for example) " CHE... (9 Replies)
Discussion started by: fabi20
9 Replies

5. Shell Programming and Scripting

Print the previous line

My requirement is that when ever search criteria matchs in log file, the previous line just above the search word as well as search word should be print. sample log file --03-19T11:26 xxx create version "a.sh@@/main/6" "104157 " --03-18T16:01 xxx create version "a.sh@@/main/5" ... (6 Replies)
Discussion started by: jadoo_c2
6 Replies

6. UNIX for Dummies Questions & Answers

Unix man command to find out month of the year?

how can i display month of the year i was born with using man command? thanks (2 Replies)
Discussion started by: janetroop95
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Previous Year Date

Hi Gurus, I would like to get the date for the previous year based on the date I specify. For e.g. If I input today's date (i.e. 20130422) I need to get 20120422. We don't have GNU and use K Shell. Any help is highly appreciated. Thanks Shash (4 Replies)
Discussion started by: shash
4 Replies

8. Shell Programming and Scripting

Print previous (non zero)

Dear All, I have file like this, 13819 32.07 1877.65 0 481.81 2100.86 0 789.35 2274.05 0 4627.61 4421.36 0 5831.52 4855.50 20844 38.68 1902.15 0 291.02 1945.88 0 452.57 2013.94 0 2194.28 ... (6 Replies)
Discussion started by: attila
6 Replies

9. Shell Programming and Scripting

How to execute previous command in UNIX?

Hi, I was able to use !! on the console. But when I used !! in the run.sh, it says something like command not found. (3 Replies)
Discussion started by: alvinoo
3 Replies
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)
All times are GMT -4. The time now is 10:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy