Home » Open Source » MySQL » Date validation in mysql
Date validation in mysql [message #566543] Mon, 17 September 2012 06:53 Go to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Hi All,

We need to create the custom function to pass the parameter is date.if it is valid return 1 else 0
it should return 1
select is_date('2012-09-17'); 

it should return 0
select is_date('2012-79-17');


Thanks,
Murali
Re: Date validation in mysql [message #566544 is a reply to message #566543] Mon, 17 September 2012 07:06 Go to previous messageGo to next message
Michel Cadot
Messages: 68617
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.google.com/#hl=en&output=search&sclient=psy-ab&q=mysql+date+validation

Regards
Michel
Re: Date validation in mysql [message #566550 is a reply to message #566544] Mon, 17 September 2012 08:03 Go to previous messageGo to next message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member

Thanks Micheal.. i got the result..
Re: Date validation in mysql [message #566552 is a reply to message #566550] Mon, 17 September 2012 08:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68617
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So post it.

Regards
Michel
Re: Date validation in mysql [message #566626 is a reply to message #566552] Tue, 18 September 2012 03:12 Go to previous message
muralikri
Messages: 638
Registered: August 2011
Location: chennai
Senior Member


select date_format(date_sub(date_add('2012/09/47', interval 1 day), interval 1 day),'%Y%m%d')  = date_format('2012/09/47','%Y%m%d');
Previous Topic: File data without -INFILE
Next Topic: MySQL data model
Goto Forum:
  


Current Time: Tue Mar 19 03:21:11 CDT 2024