Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-28-2007, 04:11 AM   PM User | #1
Erindesign
Regular Coder

 
Join Date: Apr 2006
Posts: 231
Thanks: 9
Thanked 1 Time in 1 Post
Erindesign is an unknown quantity at this point
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
Erindesign is offline   Reply With Quote
Old 08-28-2007, 04:17 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
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");).
__________________
Fumigator is offline   Reply With Quote
Old 08-28-2007, 11:30 PM   PM User | #3
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
Quote:
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.
aedrin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:21 PM.


Advertisement
Log in to turn off these ads.