Jump to content

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,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.