The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Answers to Frequently Asked Questions Please look in here before posting your questions.

LinkBacks (?)
LinkBack to this Thread: http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
Posted By For Type Date
Script to compare dates? - Shell Scripting This thread Refback 2 Weeks Ago 11:32 AM
IBM: AIX - who /var/adm/wtmp within 7 days This thread Refback 3 Weeks Ago 02:41 AM

Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 8 04-24-2008 03:04 AM
Perl: Extracting date from file name and comparing with current date MKNENI Shell Programming and Scripting 4 03-26-2008 12:01 PM
Korn Shell Script - Getting yesterdays date frustrated1 Shell Programming and Scripting 17 01-31-2008 12:56 AM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 04:42 PM
Changing Creation Date to a Prespecified Date of a File In Unix monkfan UNIX for Dummies Questions & Answers 4 11-28-2006 03:15 AM

 
 
Submit Tools LinkBack (2) Thread Tools Search this Thread Display Modes
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 04-26-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,205
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Yesterdays Date/Date Arithmetic

We get a lot of threads asking how to find yesterday's date. Or how to find the date exactly 2 months into the future, etc.

I wrote a script called datecalc that can do virtually any kind of date arithmetic. datecalc is my favorite solution. But there are several other solutions to consider. Here are some other threads....

Date function question
This thread has a perl solution, an adb solution, and an early script written by me.

Getting yesterday DATE
The last post in this thread mentions altering the TZ variable. I don't think this is very portable nor general, but it is an interesting option.

Subtracting Two months from date
This thread mentions the advanced options available with the GNU date command.

date manipulation
This thread has another perl solution.

Date Logic
Whoa... This thread has one post that suggests using a database.

Date calculation script
Here is another shell script.

get yesterday in yyyymmdd format
Review of some of above techniques by folks who didn't read this FAQ.

And a few more threads that you may find interesting....

How to find Previous date and Coming date
how to get number of seconds
Date Substraction
Calculte date time
Add Date
Julian Date
building text file with calendar dates
convert date in lilian format for shell (AIX)
Yesterday's date function
Calculating the day of the week
validating dates
Time & Date Manupulations
calcuate the week number of a given date
Keeping the format ...
Getting sysdate - 2 by an unix command
how to get month last date in unix
How to get the weekday of the given date?

And some interesting magazine articles:

Date Arithmetic with the Shell
Date arithmetic, Part 1
Date arithmetic, Part 2
Date arithmetic, Part 3

And a interesting web site:

Hermetic Systems: Calendars, Encryption, Astronomy, Prime Numbers and More


This thread shows how to do time arithmetic using the GNU date program.
Google UNIX.COM
Forum Sponsor
 



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 03:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102