Jump to content

[SOLVED] datetime manipulation


smerny

Recommended Posts

The mysql date/time functions - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

 

To format a DATETIME any way you want in a query - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format

 

The mysql DATE_FORMAT() function that I posted a link for and mentioned using in a query is not the same as the php date_format() function.

 

You would need to post your code to get specific help with what you are doing wrong in it.

well i use dates in several places... but one example would be...

 

$search = "SELECT * FROM messages WHERE ID_convo = '".$convo."'";

$result = mysql_query($search) or die ("SQL Error: ". mysql_error());

$num_msgs = mysql_num_rows($result);

while ($posts = mysql_fetch_array($result))

{

 

then within that loop i have... echo $posts['time']

 

and it comes out in the format of "2009-08-12 08:44:34", i want to know how to change that format and also if the user is logged in and has a timezone set, adjust for that

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.