php function to converts seconds into timestamp

i need any php function which can converts seconds into timestamp
for eg.




now i want to convert the time into complete timestamps in format 2011-10-04 22:41:15
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the date function.

date('Y-m-d H:i:s', $time);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
$today = date("Y-m-d H:i:s", $time);

It is not a good idea to name variables with the names of functions like $time=time();
Hugh McCurdyCommented:
Dave makes an excellent point about variable naming.  For a timestamp of the current time, I typically use $now.  Ideally the variable you use should provide information about the purpose of the variable.  $lastVisitTime, $accountCreated, $lastPurchaseTime, $bookDueDate.
Ray PaseurCommented:
Seconds ARE timestamps!

Something in format 2011-10-04 22:41:15  is not a timestamp.  It is an ISO-8601 DATETIME string.  Please take a moment to read over this article.  I think you will find it helpful.

Best regards, ~Ray
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.