mysql date
-
hi i have a problem with my sql i have a field date and its not mandatory field show user can leave this field blank but when i store this i found and error not data in correct format and if i use 0000-00-00 then its store value 1/1/1970. while i want not use this date. thanks in advance. :-D
I will do my best? Integrated Solutions, Bikaner (Raj.), India
-
hi i have a problem with my sql i have a field date and its not mandatory field show user can leave this field blank but when i store this i found and error not data in correct format and if i use 0000-00-00 then its store value 1/1/1970. while i want not use this date. thanks in advance. :-D
I will do my best? Integrated Solutions, Bikaner (Raj.), India
You could always make this field a VARCHAR (10) instead, which means that the field can take a null value; then, just insert any actual dates in the format YYYY-MM-DD, leaving fields blank where you want to, and then when you read the data from the database again, check if it's not null and if so parse it using a function like
date_parse()
. Regards, --Perspx"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds -
You could always make this field a VARCHAR (10) instead, which means that the field can take a null value; then, just insert any actual dates in the format YYYY-MM-DD, leaving fields blank where you want to, and then when you read the data from the database again, check if it's not null and if so parse it using a function like
date_parse()
. Regards, --Perspx"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvaldsthanks for reply.:rose: