|
-
May 29th, 2002, 07:16 PM
#1
Thread Starter
Stuck in the 80s
MySQL: Data as Date
How do you enter a date into a MySQL field? I've been trying to do it like this:
But it keeps coming out as: 0000-00-00
-
May 29th, 2002, 07:28 PM
#2
Fanatic Member
I tend to do mine like so:
PHP Code:
$date = date("Y-d-m");
mysql_query("insert into tableName (completeDate) values ('$date')";
-
May 29th, 2002, 08:14 PM
#3
Thread Starter
Stuck in the 80s
This doesn't help me at all.
I just can't figure this out
-
May 29th, 2002, 09:34 PM
#4
Fanatic Member
make sure the field type varchar and not int
-
May 29th, 2002, 09:56 PM
#5
Thread Starter
Stuck in the 80s
-
May 29th, 2002, 10:15 PM
#6
Fanatic Member
oh. I always used varchar and never had any problems, and I have no idea how date works.
-
May 29th, 2002, 10:37 PM
#7
Thread Starter
Stuck in the 80s
Re: MySQL: Data as Date
I just realized I had the format wrong. It needs to be:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|