Angelo Zanetti wrote:
hi guys,
I need to convert a date from this format: 2005-03-25 to 25 mar 2005.
I have tried the mktime, strftime and the date functions but they all
take a time stamp but I only have the dates in the format of 2005-03-25.
echo strtolower(date("j M Y", strtotime("2005-03-25"))
try
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}))#', $row['date'], $matches);
$month =
array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$converted_date = $matches[3]." ".$month[$matches[2]]. " ".$matches[1];
untested...
On Thu, 24 Mar 2005
yeah i know but its used for other calculations thats why i format it
with PHP!!
thanks anyway
Chris Ramsay wrote:
Angelo,
slightly OT , but as a point of interest perhaps, $row['date'] seemed
to indicate that your date comes out of a DB - you can date format
stuff with sql too - I find that usef
Angelo,
slightly OT , but as a point of interest perhaps, $row['date'] seemed
to indicate that your date comes out of a DB - you can date format
stuff with sql too - I find that useful sometimes...
With MySQL for example, if your date field is called 'myDate' you can
do the following in the query
Hi guys,
got it to work:
$datearr = split('-', $row['date']);
$tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]);
$myformat = date('j M Y',$tstamp);
echo 'myformat: ' . $myformat;
hope this can help others!!
Angelo
Angelo Zanetti wrote:
hi guys,
I need to convert a date from this format:
hi guys,
I need to convert a date from this format: 2005-03-25 to 25 mar 2005.
I have tried the mktime, strftime and the date functions but they all
take a time stamp but I only have the dates in the format of 2005-03-25.
These are what i tried where $row['date'] is 2005-02-24 but they all
retur
Try:
$variable=sprintf('%4d%02d%02d', $yy, $mm, $dd));
- Original Message -
From: "Jeff Oien" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, March 20, 2004 11:36 AM
Subject: Re: [PHP] Convert Date Format?
>
Jeff Oien wrote:
How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)
echo date('Ymd',strtotime('9/8/2001'));
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals
[EMAIL PROTECTED] wrote:
On 20 Mar 2004 Jeff Oien wrote:
How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)
How about:
Can I put that print (sprintf etc. into a variable? Thanks.
Jeff Oien
--
PHP General Mailing List (http://www.php.
On 20 Mar 2004 Jeff Oien wrote:
> How do I convert this
> 9/8/2001
> (which is Month/Day/Year)
> to this
> 20010908
> (YearMonthDay - with leading zeros)
How about:
--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
How do I convert this
9/8/2001
(which is Month/Day/Year)
to this
20010908
(YearMonthDay - with leading zeros)
Or alternatively take the Month/Day/Year format and find
anything older than 9 months ago.
Thanks.
Jeff Oien
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://
11 matches
Mail list logo