View Full Version : Date Manual
08-28-2007, 05:11 AM
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.
Echo: 19 Aug 2007
08-28-2007, 05:17 AM
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 (http://www.guelphdad.wefixtech.co.uk/sqlhelp/varchartodate.shtml) 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");).
08-29-2007, 12:30 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.