date format problem in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jiturc889
Forum Newbie
Posts: 2
Joined: Thu Jun 28, 2007 4:28 am

date format problem in PHP

Post by jiturc889 »

Hello ,

I am currently facing problem with date in php , whenever there is empty date field to be put in the mysql database, it automatically captures the timestamp as 943900200 when formatted it becomes '30-11-1999' which is wrong date.
facing this problem everywhere in application.
cant find the solution for this one,
currently handling this error by hard coding the above timestamp...
please suggest a solution for this one...

thank you in advance
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

jiturc889 wrote:whenever there is empty date field to be put in the mysql database, it automatically captures the timestamp as 943900200 when formatted it becomes '30-11-1999' which is wrong date.
What is the right date in this case?
jiturc889
Forum Newbie
Posts: 2
Joined: Thu Jun 28, 2007 4:28 am

Post by jiturc889 »

whatever date i select in my form, is get inserted into data base correctly, but when i dont select any date, that means it should be a blank field in data base, but insted it gets above timestamp automatically
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Post by idevlin »

jiturc889 wrote:whatever date i select in my form, is get inserted into data base correctly, but when i dont select any date, that means it should be a blank field in data base, but insted it gets above timestamp automatically
Unless the field in your database is set to "NOT NULL" meaning that it cannot be blank? It might then be inserting a default value which is the value you mentioned above.
Post Reply