How to calculate the difference in milliseconds of two dates

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
caxibrema
Forum Newbie
Posts: 3
Joined: Sun Nov 30, 2003 9:43 am

How to calculate the difference in milliseconds of two dates

Post by caxibrema »

How to calculate the difference in milliseconds of two dates??? :oops:
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

what format do you have the dates in?
If they are in a unix timestamp like time() gives its just deduct and multiply, if it is in some literal format convert it to unixtime by using mktime() and then deduct and multiply..
caxibrema
Forum Newbie
Posts: 3
Joined: Sun Nov 30, 2003 9:43 am

Post by caxibrema »

the dates are in the timestamp format of mysql yyyymmddhhMMss... what can i do?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

if all dates are newer than january 1st 1970 you can do as I wrote, use mktime() to convert to unixtimestamp before subtracting and then multiplying...
Post Reply