Jump to content

Problem with Date / Time Calculations


jaisol99

Recommended Posts

I have a mysql table with a timestamp field, which gives me

 

"2009-10-27 20:30:35"

(more than 1 day ago ..)

 

I'm trying to calculated how many days it is since a user loged in.

 

I figured

$time_now = date('u') 
$time_from_table = date('u', strtotime("2009-10-27 20:"30:35")

$time_now - $time_from_table = $the_number of seconds

 

I always get 0 back as an aswer

 

I've tried the calculation as date('c', ....)  and its still the same

 

Link to comment
https://forums.phpfreaks.com/topic/179558-problem-with-date-time-calculations/
Share on other sites

LOL

It all seemed so easy when I created the table... mysql Timestamp Ahhhhh

 

I think its going to become a unix datetime tommorow, normaly when I ask a question here there's an answer in 10 mins with way better code than I can come up with, its been a few hours and there's no surgestions for converting or getting the timestamp in a format that I can do calculations with....

 

your thoughts are apreciated,

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.