Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Taking the difference between starttime and end time

Links for php scripts

Moderators: macek, egami, gesf

Taking the difference between starttime and end time

Postby sansoft » Wed May 19, 2004 2:19 am

Hi all,

i am entering the starttime and end time through drop down boxes.The vals are stored in 24 hr format in a table with fields proj_sttime and proj_endtime.

Datediff function does not work with PHP......
i want to calculate the difference .Any suggesstions???

Also plz let me know the concept of timestamps.....coz i am entering the values in the table by using concantenation and do not know anything abt that.......

Regards,
Sansoft
sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India

Postby swirlee » Wed May 19, 2004 10:43 am

You can use strtotime() or mktime() to get the UNIX timestamp, and then just do regular subtraction.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

problem solved

Postby sansoft » Wed May 19, 2004 11:16 pm

Hi,

i used something like this....The problem was solved
Code: Select all

select (unix_timestamp(proj_endtime)- unix_timestamp(proj_sttime)) as time32 from proj_details;

sansoft
New php-forum User
New php-forum User
 
Posts: 44
Joined: Fri May 07, 2004 2:16 am
Location: India


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.