#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Amount calculation based on time in mysql?


    HI:

    I am new developer, i have a doubt in my application, i have to calculate the amount based on minutes in my sql.

    in my application i have stored the current date and time in datetime format in mysql.

    for example my application process is start session and close session based on the time interval the amount to be calculate.
    one use login in the time of(6.00) that use close session is (7.15)
    time interval is 1.15 hrs, per 30 mins amount is 15 how i can calculate the 1.15 hrs.. and 1.30 hrs, 2 hrs.... cont...

    i hope some one help me..
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,133
    Rep Power
    4274
    use the TIMEDIFF function
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo