Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetime not reflecting current time

Status
Not open for further replies.

DaveC426913

Programmer
Jul 28, 2003
274
CA
All my users have records showing up as the same date-time.

$dt = date("Y-m-d")." ".date("H:m:s");
$sql = "INSERT INTO AuraUsers (`UserName`,`Password`,`StartTime`) VALUES('".$Name."','".$Password."','".$dt."')";

Is thisd completely wrong?
 
Dave,
instead of your .$dt just insert NOW() without quotes and that should fix it for you.

imryn
 
Thanks.

Incidentally, I found the problem in the above:

date("H:m:s") will return 'hour, MONTH, seconds'. To display minutes I needed to use 'i' not 'm'

So, what I was seeing was:
22:04:47
22:04:13
22:04:33
etc.

The hour and seconds were being reported accurately, but the middle value was actually months instead of minutes.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top