Jump to content



Photo

How do I access the current time with MySQL?


  • This topic is locked This topic is locked
No replies to this topic

#1 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 05 August 2014 - 04:28 PM

Hi there,

 

Another common query is to get to the current time in addition to the date within mysql.

When you want to log when something happens – for instance a post to your message board, this will be a particularly useful thing to know.

With the current time and date you will need to use NOW() like so:

$update = mysql_query("UPDATE my_users SET lastlogin = NOW() WHERE username = 'user'");
?>

Cryo%20Kinesis%20Haphost%20Sig2.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users