SQL INSERT DATE

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
ronipthomas
Forum Newbie
Posts: 3
Joined: Thu Nov 11, 2010 4:37 am

SQL INSERT DATE

Post by ronipthomas »

Hi guys...
Check this db query..
When i run this query, its inseted as 0000-00-00 00:00:00..
Can anybody help me??
fight_date type is datetime.


insert into wp_fights(`fight_date`) values ( '11-11-2010 10:35:26')
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: SQL INSERT DATE

Post by Weirdan »

assuming it's MySQL you need to provide date in ISO 2014 format: YYYY-MM-DD
rahulzatakia
Forum Commoner
Posts: 59
Joined: Fri Feb 05, 2010 12:01 am
Location: Ahmedabad

Re: SQL INSERT DATE

Post by rahulzatakia »

Hi, please use the following format in insert query:

insert into wp_fights(`fight_date`) values ('2010-11-11 10:35:26')
ronipthomas
Forum Newbie
Posts: 3
Joined: Thu Nov 11, 2010 4:37 am

Re: SQL INSERT DATE

Post by ronipthomas »

Thanks Weirdan and rahulzatakia....
Post Reply