inputting and retrieving dates

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

hey,

i want to be able to insert a date in to a cell... this i can do well... but what about actually changing the time zone...

the row its going in is a VARCHAR.... any possible way ot making the time one hour forward etc?!
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

You might find something here that does what you want:

http://www.hotscripts.com/PHP/Scripts_a ... more2.html

I'm not a 100% clear on what you're asking. Do you need to compensate for your server time? or do you want it to show the users time? Regardless, there's plenty of good scripts there to look over and study.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

I have a mysql row which is data (DATETIME).

Of course you know that DATETIME has always a default value of YYYY-DD-MM

I want to be able to change this to: DD-MM-YYYY once extracted from the database. Next step, i also have the time in there which is in a different timezone.

However, i want it to be changed either +1 or -1 according to what the user wants.

So, i will be using a drop down menu which has from -10 to +10. I then want what ever the user chooses to have all the times changed by -1 hour or to +1 hour etc etc....
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

This may help some then - if nothing else, with the formatting:

http://builder.com.com/5100-31-5074826.html
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

whats wrong with this code then:

PHP Code: [ Select ]
 
<?PHP
 
 
 
 
 
$db_username = "gmforum";
 
$db_password = "";
 
$db_hostname = "localhost";    
 
$db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
 
$db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
 
$result = mysql_query("SELECT unix_timestamp(start) AS start FROM gs_rethink");
 
while ($row = mysql_fetch_array($result)) {
 
 
 
 
 
 echo = $row['start'];
 
}  
 
mysql_close($db_connect);
 
 
 
?>
 
 
  1.  
  2. <?PHP
  3.  
  4.  
  5.  
  6.  
  7.  
  8. $db_username = "gmforum";
  9.  
  10. $db_password = "";
  11.  
  12. $db_hostname = "localhost";    
  13.  
  14. $db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
  15.  
  16. $db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
  17.  
  18. $result = mysql_query("SELECT unix_timestamp(start) AS start FROM gs_rethink");
  19.  
  20. while ($row = mysql_fetch_array($result)) {
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  echo = $row['start'];
  27.  
  28. }  
  29.  
  30. mysql_close($db_connect);
  31.  
  32.  
  33.  
  34. ?>
  35.  
  36.  


i changed the row to INT(20) and inserted the date and time using a unix_timestamp... all thanks to scorpius.

But i cant retrieve it, and then convert it.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 127 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.