Sander,

I'm also in Europe but here in the UK we prefer dd/mm/yyyy and I've cobbled
together a couple of functions to handle this for me.

function dbdate($input)
{
 $today = explode("-",$input);
 $month = $today[1];
 $day = $today[2];
 $year = $today[0];
 $p_date = $day . "/" . $month . "/" . $year ;
 return $p_date;
}
function revdate($input)
{
 $today = explode("/",$input);
 $day = $today[0];
 $month = $today[1];
 $year = $today[2];
 $revdate = $year . "-" . str_pad($month, 2, "0", STR_PAD_LEFT) . "-" .
str_pad($day, 2, "0", STR_PAD_LEFT);
 return $revdate;
}
I've stored these in a file which I include and any call to the db to
display dates uses the dbdate() function and if I want to insert or update a
date then I use the revdate() function.

There are probably better ways to do this.

Hope this helps.

George in Edinburgh
----- Original Message -----
From: "Sander Peters" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, January 13, 2002 7:56 PM
Subject: [PHP-DB] convert yyyy/mm/dd to mm/dd/yyyy, how?


> Hello everybody,
>
> convert yyyy/mm/dd to mm/dd/yyyy, how?
>
> MYSQL does everything in yyyy/mm/dd.
> I live in the Netherlands and we are use to the format dd/mm/yyyy.
>
> What's the best way to display it as mm/dd/yyyy in a table on a query?
>
> My first idea whas to split the date up in vars in php and then print
> the vars in the way I like it
> Is this a bad idea? Or are there better sollutions?
>
> Thanx in advance for answering!
>
>
>
> --
> Met vriendelijke groet / With Greetings,
>
> Sander Peters
>
>    site: http://www.visionnet.nl/
>   email: mailto:[EMAIL PROTECTED]
> webmail: mailto:[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]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]

Reply via email to