Results 1 to 2 of 2

Thread: mysql date function query

  1. #1
    Join Date
    May 2006
    Posts
    2

    Post mysql date function query

    i have two date value in database, planned_end_date and actual_end_date , i.e suppose i planned that work will over 2006-03-20 but its actula end date is 2006-04-25. i have to caluculate the days difference between this. That value i have to display in report form. any mysql query for this, any suggesion please.

    Thanks
    akshaya

  2. #2
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    From the MySQL manual:

    DATEDIFF(expr,expr2)

    DATEDIFF() returns the number of days between the start date expr and the end date expr2. expr and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.

    mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
    -> 1
    mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
    -> -31

    DATEDIFF() was added in MySQL 4.1.1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •