Click to See Complete Forum and Search --> : Timestamp question
raistlin
02-06-2008, 02:03 PM
Here is what i want to do:
I want to give the possibility to the user to change a date that is store in the db...
i use the function time to format my timestamp... But i can update my timestamp in db by the one formated.
does someone has a solution for me?
jasonahoule
02-06-2008, 02:06 PM
Use the databases date_format() function if it has one.
raistlin
02-06-2008, 03:27 PM
i'm not sure this is what i'm looking for ... by the way thanks :P
Dragonkai
02-07-2008, 06:40 AM
If possible, can you clarify your question.
raistlin
02-07-2008, 09:43 AM
I build the module for rss feed management. When the user create a rss feed it insert a timestamp in the db and it also insert a expiration_date for the entry (mktime() + randomtime). When the user modify a new he has the possibility to change this expiration date to make the feed visible longer.
When i show the expiration date i'm using this function :
date("M-d-Y",$array['expiration_date']);
But when came the time to re-update it to my db the format is change and it is not a integer anymore. What can i do for this.
jasonahoule
02-07-2008, 11:26 AM
Again, use the DBMS's date_format function.
raistlin
02-07-2008, 11:34 AM
If i'm not obligate to you this i won't, it load the db and i prefer find another way if i can. I'm sure there's a way in php.
jasonahoule
02-07-2008, 12:35 PM
You are obviously writing a query to update the database so what is the problem? Just wrap your date in the date_format() function.
Of course there is a way to do it with PHP. Use the date() function to format it the way that MySQL stores it.
raistlin
02-07-2008, 01:49 PM
Finally i find THE way strtotime() just check it out on php.net :P There's alway a way :P
jasonahoule
02-07-2008, 04:22 PM
That is not a date. That is Epoch time.
raistlin
02-08-2008, 01:47 PM
i said i was using mktime()!