Adding value to date to get a date

Discussion in 'PHP' started by Grendor, Jun 7, 2005.

  1. #1
    For example if I want to input activation date(or credit that determines date of expiration) of my prepaid cell phone card, and based on that and current date php script calculates what is the expiration date.
    example:
    50$ equals 100 days of my prepaid cell card,and based on that and the current date, what is the date when my prepaid card expires?

    Any ideas are welcome.
    Thanks.
     
    Grendor, Jun 7, 2005 IP
  2. tflight

    tflight Peon

    Messages:
    617
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Straight from the PHP Manual's Date page.

    $nextyear  = mktime(0, 0, 0, date("m"),  date("d"),  date("Y")+1);
    PHP:
     
    tflight, Jun 7, 2005 IP
  3. tflight

    tflight Peon

    Messages:
    617
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oops, forgot to mention that in the example above it will leave you with a date that is exactly one year from the current date. The example and page cited should give you the info to customize it to your needs.
     
    tflight, Jun 7, 2005 IP