0

I have one field registered_date which is timestamp type in MYSQL. Now I an new with php I need your help.

I am getting this result: 2014-06-19 15:59:49

and I want this output: 19 June 2014 15:59 PM

Note: I am storing timestamp in php variable from sql query.

Any Idea?

0

2 Answers 2

1

http://php.net/manual/en/function.strtotime.php
http://php.net/manual/pl/function.date.php

$date = date('D M Y H:i A', strtotime($timestamp));
Sign up to request clarification or add additional context in comments.

Comments

1

Since you tagged the question with mysql here is the mysql solution, you can use date_format() function while selecting the data and you will have desired format.

mysql> select date_format('2014-06-19 15:59:49','%d %M %Y %H:%i %p') as date ;
+-----------------------+
| date                  |
+-----------------------+
| 19 June 2014 15:59 PM |
+-----------------------+
1 row in set (0.00 sec)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.