RE: [PHP] Formating datevariables...
Why not let mysql do it? It has a function do to exactly that, I think... But php's date() is the function you're looking for... -Original Message- From: Ragnar [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- 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] Formating datevariables...
Yeah .. the php function date shud do it .. if only the timestamp would be in the correct format. I've been wrestling with it too, best way to do it for me was using some substr() calles to extract year, month and day from it. anybody better ideas? -- Alle door mij verzonden email is careware. Dit houdt in dat het alleen herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid. All email sent by me is careware. This means that it can only be reread and kept if you are good for all the life here on earth and beyond. If you don't agree to these terms, you should return this email in no more than 24 hours stating the reason of disagreement. -Oorspronkelijk bericht- Van: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 23 juli 2002 01:51 Aan: 'Ragnar'; [EMAIL PROTECTED] Onderwerp: RE: [PHP] Formating datevariables... Why not let mysql do it? It has a function do to exactly that, I think... But php's date() is the function you're looking for... -Original Message- From: Ragnar [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Formating datevariables...
Select TIMESTAMP(date_column) AS mydate Then when you display it use the date function DATE('mdY',mydate) -Original Message- From: Ragnar [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formating datevariables...
Is the timestamp in UNIX format? if yes, try date() http://www.php.net/manual/en/function.date.php if no, try substr() hope that helps :) - Jeremy - Original Message - From: Ragnar [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 23, 2002 7:42 AM Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- 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] Formating datevariables...
As Demitrious said, use mysql to do it. But if you want to use php, just use substr(), since all the numbers are there, there's no point converting to unix time, just to convert it back again... unless you're going to do some maths of it -Original Message- From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 9:51 AM To: 'Ragnar'; [EMAIL PROTECTED] Subject: RE: [PHP] Formating datevariables... Why not let mysql do it? It has a function do to exactly that, I think... But php's date() is the function you're looking for... -Original Message- From: Ragnar [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Formating datevariables... I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? Thanx -R -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Formating datevariables...
I have a column in a mysql table with a timestamp. The value of this column is for instance: 20020722185242 How do i change the format on this to DDMM (22072002) in php? SELECT DATE_FORMAT(date_column,'%d%m%Y') AS Formatted_Date FROM your_table There's no need to involve PHP at all... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php