RE: [PHP] Changing MySQL Date Format

2004-08-12 Thread Jay Blanchard
[snip]
I'm using a hell of a lot of dates in my databases and wondered if it
was
possible to change the date format in my databases from -00-00 to:
00-00-...?

Has anyone else managed to do this or use any workarounds I could use
perhaps...?

I'm just getting a little hacked of having to explode the damn things
every
time I use them.
[/snip]

The date time format is pretty standard, start here
http://www.mysql.com/date
You could write a date function that does your explosions for you. Or
you could query the MySQL list for other solutions. (pun intended)

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



Re: [PHP] Changing MySQL Date Format

2004-08-12 Thread Stephan Fiedler
Hi Harlequin,
Harlequin wrote:
[...]

I'm just getting a little hacked of having to explode the damn things every
time I use them.
You EXPLODE them??
When you want it human readable why not simply
preg_replace(/(\d{4})-(\d{2})-(\d{2})/, $3-$2-$1 [*], $input);
it?
or preg_replace it to something machine-readable and for the output use 
strftime?

or even simpler: select unixtimestamp(mytime) and strftime later?
Stephan
[*] if you want the month leading it is $2-$3-$1...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Changing MySQL Date Format

2004-08-12 Thread Brent Clements
Why not just write a simple function in php to change your date around for
you? A function in a utility class perhaps?

-Brent

- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Harlequin [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, August 12, 2004 7:39 AM
Subject: RE: [PHP] Changing MySQL Date Format


[snip]
I'm using a hell of a lot of dates in my databases and wondered if it
was
possible to change the date format in my databases from -00-00 to:
00-00-...?

Has anyone else managed to do this or use any workarounds I could use
perhaps...?

I'm just getting a little hacked of having to explode the damn things
every
time I use them.
[/snip]

The date time format is pretty standard, start here
http://www.mysql.com/date
You could write a date function that does your explosions for you. Or
you could query the MySQL list for other solutions. (pun intended)

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

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



Re: [PHP] Changing MySQL Date Format

2004-08-12 Thread John Holmes
Stephan Fiedler wrote:
Hi Harlequin,
Harlequin wrote:
[...]

I'm just getting a little hacked of having to explode the damn things 
every
time I use them.

You EXPLODE them??
When you want it human readable why not simply
preg_replace(/(\d{4})-(\d{2})-(\d{2})/, $3-$2-$1 [*], $input);
it?
or preg_replace it to something machine-readable and for the output use 
strftime?

or even simpler: select unixtimestamp(mytime) and strftime later?
Stephan
[*] if you want the month leading it is $2-$3-$1...
Or just use DATE_FORMAT() in your query...
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php