RE: [PHP-DB] MySQL date formats

2001-12-20 Thread Rick Emery

Try in PHP.  This should take "12/25/2001" in $input_date and convert it to
"20011225" in $db_date.  Then write $db_date to mySQL database.
Perform similar conversion when extracting from database.

Or instruct your users to use MMDD.

$thedate = explode("/",$input_date);   //$thedate[0]=DD, $thedate[1]=MM,
$thedate[2]=
$db_date = date("Ymd", mktime(0,0,0,$thedate[1],$thedate[0],$thedate[2]) );

-Original Message-
From: nautilis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 11:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL date formats


Hi everyone!

I have a little problem with my MySQL database in the way it stores dates.
The only format i can have is /MM/DD, and when i request this date from
my php page, this date is insertes in this format. As my website is going to
be for spanish users, the correct format would be DD/MM/, but i have no
idea about changing this, either on the database or when i process it with
php.

Thanks in advance for reading my post. I hope anyone can point me into the
right direction.

nautilis



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] MySQL date formats

2001-12-20 Thread Jim Lucas

in your select statement that you pull the date out with.  wrap that column
with


SELECT UNIX_TIMESTAMP() FROM table;

this will return the unix timestamp now with this format use the date()
function and format the date how ever you would like.

Jim
- Original Message -
From: "Rosser, Chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'nautilis'" <[EMAIL PROTECTED]>
Sent: Thursday, December 20, 2001 9:36 AM
Subject: RE: [PHP-DB] MySQL date formats


> nautilis,
>
> Leave the date in the database in MySQL format (/MM/DD) and when you
> need to display the date on your page, just do this:
>
> 
> explode("/", $datearray);
> $date = $datearray[2].'/'.$datearray[1].'/'.$datearray[0];
>
> ?>
>
> That just splits up the three numbers, and rearranges them. Easy :)
>
> Chris
> }:)
>
> > -Original Message-
> > From: nautilis [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, December 20, 2001 5:11 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] MySQL date formats
> >
> > Hi everyone!
> >
> > I have a little problem with my MySQL database in the way it stores
dates.
> > The only format i can have is /MM/DD, and when i request this date
> > from
> > my php page, this date is insertes in this format. As my website is
going
> > to
> > be for spanish users, the correct format would be DD/MM/, but i have
> > no
> > idea about changing this, either on the database or when i process it
with
> > php.
> >
> > Thanks in advance for reading my post. I hope anyone can point me into
the
> > right direction.
> >
> > nautilis
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL date formats

2001-12-20 Thread Rosser, Chris

Sorry, correction:





> -Original Message-
> From: Rosser, Chris 
> Sent: Thursday, December 20, 2001 5:37 PM
> To:   [EMAIL PROTECTED]
> Cc:   'nautilis'
> Subject:  RE: [PHP-DB] MySQL date formats
> 
> nautilis,
> 
> Leave the date in the database in MySQL format (/MM/DD) and when you
> need to display the date on your page, just do this:
> 
>  
> explode("/", $datearray);
> $date = $datearray[2].'/'.$datearray[1].'/'.$datearray[0];
> 
> ?>
> 
> That just splits up the three numbers, and rearranges them. Easy :)
> 
> Chris
> }:)
> 
>   -Original Message-
>   From:   nautilis [SMTP:[EMAIL PROTECTED]]
>   Sent:   Thursday, December 20, 2001 5:11 PM
>   To: [EMAIL PROTECTED]
>   Subject:[PHP-DB] MySQL date formats
> 
>   Hi everyone!
> 
>   I have a little problem with my MySQL database in the way it stores
> dates.
>   The only format i can have is /MM/DD, and when i request this
> date from
>   my php page, this date is insertes in this format. As my website is
> going to
>   be for spanish users, the correct format would be DD/MM/, but i
> have no
>   idea about changing this, either on the database or when i process
> it with
>   php.
> 
>   Thanks in advance for reading my post. I hope anyone can point me
> into the
>   right direction.
> 
>   nautilis
> 
> 
> 
>   -- 
>   PHP Database Mailing List (http://www.php.net/)
>   To unsubscribe, e-mail: [EMAIL PROTECTED]
>   For additional commands, e-mail: [EMAIL PROTECTED]
>   To contact the list administrators, e-mail:
> [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL date formats

2001-12-20 Thread Rosser, Chris

nautilis,

Leave the date in the database in MySQL format (/MM/DD) and when you
need to display the date on your page, just do this:



That just splits up the three numbers, and rearranges them. Easy :)

Chris
}:)

> -Original Message-
> From: nautilis [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, December 20, 2001 5:11 PM
> To:   [EMAIL PROTECTED]
> Subject:  [PHP-DB] MySQL date formats
> 
> Hi everyone!
> 
> I have a little problem with my MySQL database in the way it stores dates.
> The only format i can have is /MM/DD, and when i request this date
> from
> my php page, this date is insertes in this format. As my website is going
> to
> be for spanish users, the correct format would be DD/MM/, but i have
> no
> idea about changing this, either on the database or when i process it with
> php.
> 
> Thanks in advance for reading my post. I hope anyone can point me into the
> right direction.
> 
> nautilis
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]