print date from database [closed]
When I pull the date out of the db, it comes back like this:
1314718511
1314212730
1314210433
1314210352
I want like this:-
08/31/11 14:43:29 IST
Use date()
(http://php.net/manual/en/function.date.php), or the DateTime
class (http://php.net/manual/en/class.datetime.php) when you want to do transformations (like time zones).
If your database is MySQL also check out the from_unixtime and unix_timestamp functions. You'll see you can do this conversion either at SQL level or as Rijk pointed out, in PHP.
精彩评论