![]() |
|
#1
|
||||
|
||||
Re: Get the date / time difference with PHPI just posted a GID Community blog entitled: Get the date / time difference with PHP.
Quote:
Please let me know what you think. This is an auto-generated message posted by GIDNetwork™ on behalf of the author. |
||||
|
#2
|
|||
|
|||
calculating time difference between two dateHi all,
i'm new here, i have problem with calculating time difference , i've read the thread "Time Calculation not considering minutes" by justinhn, and i found the answer in "Get the date / time difference with PHP" by admin, so i've tried that code and it works!, but when i tried to input: example: START time value = 23:30 and END time value = 24:00, the result was error,and then i change END time to= 00:00 and the result still error, i didn't understand where are the problems,and why it could happen......:?: , and the main problems:!: : i want to ask about how to calculating time difference in HH:MM:SS (hours:minutes:seconds) between two different date,for the example, the input are : $start_date : 2006-06-08, $start_time : 23:30 $end_date : 2006-06-09, $end_time : 02:15, Please help me to solve this problem, because i can't find any answer from any search engine like google or yahoo. THANKS after and before.:smile: |
|
#3
|
||||
|
||||
Re: calculating time difference between two dateThank you for your question.
If you ask me how many hours between 03:00:00 and 00:00:00, I can immediately assume you mean midnight (00:00:00) of tomorrow. But a computer doesn't assume, so if you submit just the HH:MM:SS bits to the function, it assumes it's midnight of today and not midnight of tomorrow (which is what I assume you meant). Get it? If you look at the insides of the function, you will see that the unixtimestamp is set by this line: PHP Code:
It's always safe to include the date values too... for example, using your example values... PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
|||
|
|||
Re: Get the date / time difference with PHPThanks alot for the answer, i really appreciated that.
i've tried the code and it's work, but we've another problem here, when we have input like this : $start_date = '2006-06-08'; $start_time = '22:30'; $end_date = '2006-06-09'; $end_time = '22:30'; why the result are(in HH:MM) : 00:00 hours ? not 24 (hours):00 (minutes)? or.... //for example, it have different about 2 days $start_date = '2006-06-08'; $start_time = '22:30'; $end_date = '2006-06-10'; $end_time = '10:30'; why the result are(in HH:MM) : 12:00 hours ?, not 36 (hours): 00 (minutes) how can we get total time, is it possible to calculating them? Thanks. |
|
#5
|
|||
|
|||
Re: Get the date / time difference with PHPhey..in relation..
i have also problem in tracing the time difference my start date is=08.1.2006 my end date is=12.1.2006 how will i able to know that the if i already expire or not..in short the date between 08.1.2006 and 12.1.2006 please im new here i need some help.. |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Limit combo box and date time picker choice according to database created in folder | shinyhui | C++ Forum | 0 | 22-Feb-2005 20:16 |
| Limit combo box and date time picker choice according to database created in folder | shinyhui | MS Visual C++ / MFC Forum | 0 | 22-Feb-2005 02:13 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 15:13 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 09-Mar-2004 23:56 |
| Easily keep up to date with the latest PHP news (and any other for that matter) | jrobbio | MySQL / PHP Forum | 0 | 03-Jun-2003 03:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The