![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find out future date | purveshvora | UNIX for Dummies Questions & Answers | 2 | 06-03-2009 02:30 AM |
| add or modify if existent | melanie_pfefer | Shell Programming and Scripting | 4 | 03-28-2007 04:28 AM |
| How Do I Set a Task to Happen in the Future? | Slick | UNIX for Dummies Questions & Answers | 2 | 08-09-2006 11:38 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Checking for future / non existent dates
'm attempting to script an application for the bash shell. The application needs to check for birthday, but must check the birthday to see if the date is a) in the future b) exists at all (ie Feb 29th during non-leap years). The input is being entered in a YYYYMMDD format, so I was hoping someone could point me in the direction for how to check for future dates and non-existent dates.
Thanks - D |
|
||||
|
This script will validate the format and checks for the date availability in the calendar (thus solves leap year problem). But as the user expected it will not check whether the date falls on future or not. So the user has to take care of it in his script like this:
if [ "`date '+%Y%m%d'`" -ge "$DATE" ]; then ..... fi |
![]() |
| Bookmarks |
| Tags |
| bash, bash eval, eval |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|