Jump to content

[SOLVED] PHP current_date help


`Karl

Recommended Posts

I'm currently using this:

$sql="INSERT INTO (id, modifiedon)
VALUES ('',current_date)";

 

to save when a page has been edited. The database type is set as date. So when I call it at a later time, the format is 2009-11-02 18:32:29, etc.

 

I was wondering how I'd go about changing this format so that it's displayed how I want it. (02/11/2009 at 18:32 GMT).

 

But I'm a rookie at this atm, hope you understand what I'm asking.

 

Link to comment
https://forums.phpfreaks.com/topic/180300-solved-php-current_date-help/
Share on other sites

So this should work?

 

<?php
echo date('d/m/Y H:i \G\M\T',strtotime($arr['datetime']));
?>

 

Because I'm receiving this

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/karl/public_html/index.php on line 80

<div style="border-bottom:1px; solid #21405c; background: #232323; margin: 0 12.80em 0 12.80em; text-indent:50px;">
<b><font size="2" color="#FFFFFF">{$arr['title']}</font></b><br>

<div style="border-top:1px solid #21405c; text-indent: 0px; margin-left:4px; margin-right:4px;"><font size="2" color="#FFFFFF">{$arr['news']}</font></div>

<div style="text-align: right; border-bottom:2px solid #21405c;"><font size="1" color="#FFFFFF"><div style="margin-right: 10px;">Posted by</font> <font size="1" color="#3d75a7">{$arr['postedby']}</font> <font size="1" color="#FFFFFF">on</font> <font size="1" color="#3d75a7"><?php echo date('d/m/Y H:i \G\M\T',strtotime($arr['datetime'])); ?></font></div></div>
</div>

HTML;
} 
   }else{

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.