1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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