Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Date Manual

  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    231
    Thanks
    9
    Thanked 1 Time in 1 Post

    Date Manual

    I have a script that I am modifying. I redid the photo upload and unfortunately don't have the original.

    Basically, there is a date stored in the database, under dateadded. When they echo it, they use date(j M Y, $photo["dateadded"]);

    Now, when people upload new photos, I need to insert a date into the dateadded, but don't know what to put.

    example:
    Database: 1187568954
    Echo: 19 Aug 2007

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    It looks like you are storing a unix timestamp, which is the number of seconds since Unix' birthday of some time in 1970. This is a lousy way to do it, and if you have the gumption then you have a great opportunity to improve your data by converting that lousy way of storing a timestamp to a "datetime" type column. Guelphdad has a good tutorial for doing so.

    But if you don't want to do that then you'll want to grab the current unix timestamp when you insert a row in the table ($currentTimestamp = date("U");).

  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    This is a lousy way to do it, and if you have the gumption then you have a great opportunity to improve your data by converting that lousy way of storing a timestamp to a "datetime" type column.
    It's not lousy, it's just a different way of storing it. Depending on requirements either of the two methods is better.

    Neither is superior.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •