Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check date input

Status
Not open for further replies.

Matsul

IS-IT--Management
May 6, 2002
140
BE
Is there an easy way of checking if a date is in the format
YYYYMMDD ?

I have a script that takes a date as input and need it to exist with error in the case of an invalid date.

eg
>check_report 20070788

ERROR invalid date


thanks
 
Hi

Matsul said:
>check_report 20070788

ERROR invalid date
Well, that "88" at the end of the string looks strange to me too.

If you have GNU [tt]date[/tt], that certainly can recognize that format. Maybe others too.
Code:
[blue]master #[/blue] date -d 20070788
date: invalid date `20070788'

[blue]master #[/blue] date -d 20070708
Sun Jul  8 00:00:00 EEDT 2007

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top