fathak
fathak

Reputation: 31

How to convert yyyy/mm/dd to dd/mm/yyyy?

I would like to convert yyyy/mm/dd to dd/mm/yyyy format.So, I am using strtotime() function.but when I get zero date like(0000/00/00) from mysql. It will be showing wrong date like(01-01-1970).

I need exact string like 0000/00/00 to 00/00/0000. any other function are there?

Upvotes: 2

Views: 6937

Answers (2)

Mchl
Mchl

Reputation: 62387

Try MySQL's DATE_FORMAT() function

SELECT DATE_FORMAT(dateColumn,'%d/%m/%Y') AS dateColumn FROM table...

Upvotes: 3

Adi
Adi

Reputation: 4904

Try to use strftime

strftime("%d-%b-%Y", strtotime($value['your_date']));

Upvotes: -1

Related Questions