Re: [PHP-DB] easy date format question

2002-03-04 Thread Dan Brunner

Hello!!

it should be

$today = Date("Y"-"m"-"d");


Dan


On Friday, March 1, 2002, at 04:50 PM, [EMAIL PROTECTED] wrote:

> should be simple as pie, of course, but i can't find a straightforward
> syntax example in the documentation. i'm trying to change the PHP date
> format to mysql's.
>
> my code:
> $today = date("MMDD");
> $sql = "INSERT into table (date) values ('$today')";
> and so on...
>
> is filling the date field with zeros, instead of 2002-02-28
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] easy date format question

2002-03-02 Thread Boaz Yahav

or :

$sql="INSERT INTO table (date) VALUES (now())";

-Original Message-
From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 02, 2002 2:11 AM
To: [EMAIL PROTECTED]; Matthew Crouch
Subject: Re: [PHP-DB] easy date format question


$today = date("Ymd");
$sql = "INSERT into table (date) values ('$today')";

when the $today variable is inserted into a mysql date column it will
fit
just right.
but, if you want to insert it into a timestamp column, you will have to
padd
it with 6 zero's

Jim Lucas
www.bend.com

- Original Message -
From: "Matthew Crouch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 2:50 PM
Subject: [PHP-DB] easy date format question


> should be simple as pie, of course, but i can't find a straightforward
> syntax example in the documentation. i'm trying to change the PHP date
> format to mysql's.
>
> my code:
> $today = date("MMDD");
> $sql = "INSERT into table (date) values ('$today')";
> and so on...
>
> is filling the date field with zeros, instead of 2002-02-28
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] easy date format question

2002-03-01 Thread Jim Lucas [php]

$today = date("Ymd");
$sql = "INSERT into table (date) values ('$today')";

when the $today variable is inserted into a mysql date column it will fit
just right.
but, if you want to insert it into a timestamp column, you will have to padd
it with 6 zero's

Jim Lucas
www.bend.com

- Original Message -
From: "Matthew Crouch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 2:50 PM
Subject: [PHP-DB] easy date format question


> should be simple as pie, of course, but i can't find a straightforward
> syntax example in the documentation. i'm trying to change the PHP date
> format to mysql's.
>
> my code:
> $today = date("MMDD");
> $sql = "INSERT into table (date) values ('$today')";
> and so on...
>
> is filling the date field with zeros, instead of 2002-02-28
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] easy date format question

2002-03-01 Thread Matthew Crouch

should be simple as pie, of course, but i can't find a straightforward
syntax example in the documentation. i'm trying to change the PHP date
format to mysql's.

my code:
$today = date("MMDD");
$sql = "INSERT into table (date) values ('$today')";
and so on...

is filling the date field with zeros, instead of 2002-02-28


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php