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.

Date and time - insert into website

Discussion in 'PHP' started by emozunny, Feb 17, 2010.

  1. #1
    I am making my own forum. I have only limited knowledge of dates and times. When someone makes a post I want to detect the time of the post and the date or maybe even the date time.

    How would I write this in PHP. If I store this in a date and time within a database are there any problems with that
     
    emozunny, Feb 17, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Use the time() function.
     
    danx10, Feb 17, 2010 IP
    emozunny likes this.
  3. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #3
    I always store it in the database using a bigint(12) , and the function time()

    and when extracting using date("Y-m-d h:i",$time)

    But this is just me.. This way i can delete "old entries" and such easily..
     
    n3r0x, Feb 17, 2010 IP
    emozunny likes this.