One day Back Date

Discussion in 'PHP' started by babaMBA, Aug 2, 2007.

  1. #1
    Hi

    I am saving the date in the database as expiry date e.g "2007-6-25" and in my email i want to send one day back date for payment, for this date it is
    "2007-6-24" , I did it by "day - 1" but it cause prablem for dates that are expired on 1. This make 1 to 0 and not 31 or 30. Is there any query that gives me one day back date.

    plz help mee.
     
    babaMBA, Aug 2, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Can you post the code you're currently using?

    Maybe something like:
    
    $one_day_back = strtotime('-1 Day', strtotime($original_date));
    
    PHP:
    Would work...

    Or are you doing that with SQL alone?
     
    nico_swd, Aug 2, 2007 IP
  3. Vbot

    Vbot Peon

    Messages:
    107
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    How about:
    $yesterday = date("Y-m-d", time()-60*60*24);
    PHP:
    Then query select "day = '$yesterday'"

    Edit: :).
     
    Vbot, Aug 2, 2007 IP
  4. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #4
    $yesterday = date("Y-m-d", strtotime('-1 Day',"2007-6-25"));
    PHP:
    Ha

    __________________
    Rep [​IMG] is used for good answers. :)
     
    exodus, Aug 3, 2007 IP