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.

working with dates in PHP

Discussion in 'PHP' started by vijaykoul, Mar 5, 2005.

  1. #1
    hi,

    i am working on a project which requires me to subtract different dates
    can anybody tell me how to find the difference between dates in PHP as there is no function in PHP, I suppose.

    Thanks in advace
     
    vijaykoul, Mar 5, 2005 IP
  2. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #2
    You might take a look at this tutorial.
     
    ResaleBroker, Mar 5, 2005 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can just use timestamps time() or date('U') and then add/subtract them. Then format the timestamp for display date( 'formatstr', $timestamp ); To see how to format, see php.net
     
    exam, Mar 5, 2005 IP
  4. dtan

    dtan Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    timestamps are an integer representation of time in seconds. For php, most applications can use timestamps fine. However, be careful if the dates you need to use will be before 1901 and after 2038.
     
    dtan, Mar 22, 2005 IP