[NTLUG:Discuss] verify that a text string is a valid date.

Burton Strauss Burton_Strauss at comcast.net
Wed Feb 1 21:17:18 CST 2006


For me, the hinkiest way to do this has always been to convert the date ->
Julian and then convert back.  If they match, it's a valid date.

Look at the date command - plus probably cut.  So find --pipe-> cut --pipe->
date and check the return code...

-----Burton
 

-----Original Message-----
From: discuss-bounces at ntlug.org [mailto:discuss-bounces at ntlug.org] On Behalf
Of Richard Geoffrion
Sent: Wednesday, February 01, 2006 12:59 PM
To: NTLUG Discussion List
Subject: [NTLUG:Discuss] verify that a text string is a valid date.

I'm trying to do something but I don't know what it is called.

I want to check to see if the first 10 characters of a file is a vaild
date...eg  2006-02-01  and if it IS..then I want to continue the process.

What am I trying to do in bash(or other utility terms)?  I don't know the
name of what I'm trying to do so I'm finding it difficult to search.

--
rtcg

_______________________________________________
https://ntlug.org/mailman/listinfo/discuss





More information about the Discuss mailing list