PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
the php date and time functions are designed to work with unix timestamps. the date you have in your db is not a unixtimestamp and is therefore an invalid value, causing these functions to default to the current date and time. try this:
The reason why you are getting the current date is because time() doesn't accept any arguments and only ever returns the current UNIX timestamp - to get the timestamp for another time you need to use mktime() as mydimension does in his example.
It would be easier if you stored the date in the database (assuming MySQL here 'cause you don't say which you use) as a DATE or TIMESTAMP field, that way you can use the database to format the date when you extract it: http://www.mysql.com/doc/en/Date_and_ti ... ml#IDX1281
I'm not sure why using a DATE or TIMESTAMP field would not work because of using phpMyAdmin - it really is the best way to store dates as it makes them a lot easier to work with and to extract the way you want.
However, the parse error with MyDimension's code - there's a parenthesis missing on this line: