Search
Generic filters
Exact matches only
  • MySQL DATE_SUB Function – Date minus time

    2nd June 2014

    MySql

    mysql codehaven category

    Assume we have the following Orders

    OrderId: 1
    ProductName : OrderDate1
    Cheese: 2008-11-11 13:23:44
    Now we want to subtract 5 days from the OrderDate date.We use the following SELECT statement:

    Result: 2008-11-06 13:23:44

    Was this code snippet helpful?

    Comment on this Code Snippet?