PDA

View Full Version : Subtracting Dates/Times



inchecksolution
11 Apr 2011, 09:40 PM
I am displaying some information gathered from an XML file. This file shows a sale that is currently on, and includes a value of when the sale ends:

<ends_at>Tue, 12 Apr 2011 03:59:59 -0700</ends_at>

On my site, I want to display the time remaining to purchase the deal when the page loads (example- Time Remaining: 12hr 49min)

Is there a way to somehow take the the <ends_at> time and subtract the current time to get the time remaining based on the format the <ends_at> time is sent through the XML doc? I don't need a live countdown or anything. Just a 1 time calculation that executes when the page loads/is refreshed.

Thanks for any help you can offer!