I'm displaying a date that I get from a informix database query - the date
format is as follows;
2002-12-04 23:21:49
I want it to display as 12/4/2002 11:21:49 PM
Jeff
Jason Wong [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Wednesday 04 December 2002
Hi,
?
$date = '2002-12-04 23:21:49';
$newdate = date('m/d/Y', strtotime($date));
echo $newdate;
?
Should do the trick -- although I haven't stripped out the leading 0 in
either the day or month, hence it will echo 12/04/2002, not 12/4/2002.
Season to taste,
Justin
on 05/12/02 10:58 AM,
At 04:58 PM 12/4/02 -0700, Jeff Bluemel wrote:
I'm displaying a date that I get from a informix database query - the date
format is as follows;
2002-12-04 23:21:49
I want it to display as 12/4/2002 11:21:49 PM
$Hour = substr( $Date, 11, 2 );
if( $Hour ) 12 {
$Hour = $Hour - 12;
$AMPM =
on 05/12/02 11:15 AM, Justin French ([EMAIL PROTECTED]) wrote:
Hi,
?
$date = '2002-12-04 23:21:49';
$newdate = date('m/d/Y', strtotime($date));
echo $newdate;
?
Whooops, forgot the time bit!
Should be
?
$date = '2002-12-04 23:21:49';
$newdate = date('n/j/Y g:i:s a', strtotime($date));
on 05/12/02 11:37 AM, Rick Widmer ([EMAIL PROTECTED]) wrote:
$Hour = substr( $Date, 11, 2 );
if( $Hour ) 12 {
$Hour = $Hour - 12;
$AMPM = 'PM';
}
else {
$AMPM = 'AM';
}
echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/',
substr( $Date, 0, 4 ), ' ', $Hour, substr( $Date,
thanks...
I will play with this, and let ya know if I have a problem... looks easy
enough.
Jeff
Justin French [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
on 05/12/02 11:15 AM, Justin French ([EMAIL PROTECTED]) wrote:
Hi,
?
$date = '2002-12-04
At 11:51 AM 12/5/02 +1100, Justin French wrote:
on 05/12/02 11:37 AM, Rick Widmer ([EMAIL PROTECTED]) wrote:
$Hour = substr( $Date, 11, 2 );
if( $Hour ) 12 {
$Hour = $Hour - 12;
$AMPM = 'PM';
}
else {
$AMPM = 'AM';
}
echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/',
on 05/12/02 12:47 PM, Rick Widmer ([EMAIL PROTECTED]) wrote:
Yes, it is simpler to code, but it also takes almost twice as long to run.
1000 iterations with strtotime: 0.2296 seconds
1000 iterations with substr:0.1308 seconds
Doesn't matter much if you only do it once, but it can add
worked great...
the other method may be a little quicker, but this code is easier for me to
understand, and although it is used in a loop there really is no visible
difference in how quickly it displays.
thanks,
Jeff
Justin French [EMAIL PROTECTED] wrote in message
[EMAIL
ok - I've been looking through this...
the number_format is working great (actually I finally found that function
right before I read your response), but the date format doesn't seem to
allow me to pass it a date.
Jeff
Kevin Stone [EMAIL PROTECTED] wrote in message
On Wednesday 04 December 2002 08:29, Jeff Bluemel wrote:
... but the date format doesn't seem to
allow me to pass it a date.
Your code?
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design Hosting * Internet Intranet Applications
11 matches
Mail list logo