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
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

Link to comment
Share on other sites

<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{

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.