0

I have a string

date = 25 aug 18

is there any way to convert this into date time format,

date = 25 August 2018
mach2
  • 450
  • 2
  • 6
  • 24
  • Please go through this link for your [help](http://php.net/manual/en/function.date.php) – Rahul Aug 28 '18 at 12:21

1 Answers1

1

Use:

echo  date('d F Y', strtotime("25 aug 2018")). "\n";

output: https://3v4l.org/2T9NF

refer:

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

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

Ketan Yekale
  • 2,108
  • 3
  • 26
  • 33
  • Thanks a lot it worked. But when I do `date('d F Y', strtotime('08/10/2018'));` , it shows me 10 August 2018 instead of showing 08 October 2018? Why is that? – mach2 Aug 28 '18 at 19:13
  • strtotime uses american date notations i.e. mm/dd/yyyy when the input string is of the format **/**/**** – Ketan Yekale Aug 28 '18 at 19:19
  • Now that you are experimenting with date formats, have a look at my answer: https://stackoverflow.com/questions/52058697/date-formatting-in-php-for-string-with-am-and-pm/52059182#52059182 it shows how to use different date formats. – Ketan Yekale Aug 28 '18 at 19:27
  • Also, a humble request to approve and upvote the answers. – Ketan Yekale Aug 28 '18 at 19:28