Jump to content

[SOLVED] php date


Porl123

Recommended Posts

Hi people, I'm not sure whether this might be a mysql problem but I'm hoping you can help me anyway. I've got a news page where time stamps are recorded using the NOW() function in mysql, but every time I echo it back it's off completely

 

date('D, d F', $date)

 

is what I'm using to format it and

 

Wed, 31 December

 

is what it returns. Anyone know why? Thanks

Link to comment
https://forums.phpfreaks.com/topic/130702-solved-php-date/
Share on other sites

or like this...

<?php
$datetime = $row['date'];
$year = substr( $datetime, 0, 4 );
$mon = substr( $datetime, 4, 2 );
$day = substr( $datetime, 6, 2 );
$hour = substr( $datetime, 8, 2 );
$min = substr( $datetime, 10, 2 );
$sec = substr( $datetime, 12, 2 );
$orgdate = date("F j, Y",
mktime( $hour, $min, $sec, $mon, $day, $year ) );

echo $orgdate;
?>

Link to comment
https://forums.phpfreaks.com/topic/130702-solved-php-date/#findComment-678265
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.