Jump to content


Photo

datetime column in database


  • Please log in to reply
2 replies to this topic

#1 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 12:28 PM

im in uk, so therefore i want it to show GMT time but it shows 6 hours behind...how can i change it to gmt?

*note* it is for an updates section, when an admin posts an update it shows time aswell
Visit my Game - Under Construction

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 October 2006 - 12:32 PM

You can use date_default_timezone_set() for that. Notice you need PHP5.

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 12:58 PM

how would i use that??
$title= $_POST['title'];
$uptext= $_POST['uptext'];
$time = date("Y-m-d H:i:s"); 

if((!$title) || (!$uptext)){ 
echo 'You did not submit the following required information! <br />'; 
if(!$title){ 
echo "A title is required field. Please enter it below.<br />"; 
} 
if(!$uptext){ 
echo "Update text is required field. Please enter it below.<br />"; 
} 
echo "SOMETHING IS WRONG!!!"; 
exit();
} 
$sql = mysql_query("INSERT INTO updates (title, uptext, time) 
VALUES('$title', '$uptext', '$time')") 
or die (mysql_error());

Visit my Game - Under Construction




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users