Skip to main content
Commonmark migration
Source Link

In PHP, you can convert date to any format by using a combination of date and strtotime function.

Please try below format to convert date:

date(format, strtotime(originaldate))

Suppose, you have original date as mm/dd/yy (say 21/03/10) and you want to convert it to yy/mm/dd H:i:s format (say 10/03/21 00:00:00), then try below code:

$originalDate = "21/03/10";

 

$newDate = date("d-m-Y H:i:s", strtotime($originalDate));

In PHP, you can convert date to any format by using a combination of date and strtotime function.

Please try below format to convert date:

date(format, strtotime(originaldate))

Suppose, you have original date as mm/dd/yy (say 21/03/10) and you want to convert it to yy/mm/dd H:i:s format (say 10/03/21 00:00:00), then try below code:

$originalDate = "21/03/10";

 

$newDate = date("d-m-Y H:i:s", strtotime($originalDate));

In PHP, you can convert date to any format by using a combination of date and strtotime function.

Please try below format to convert date:

date(format, strtotime(originaldate))

Suppose, you have original date as mm/dd/yy (say 21/03/10) and you want to convert it to yy/mm/dd H:i:s format (say 10/03/21 00:00:00), then try below code:

$originalDate = "21/03/10";

$newDate = date("d-m-Y H:i:s", strtotime($originalDate));

Source Link
Mohit Kumar Arora
  • 10.2k
  • 7
  • 28
  • 56

In PHP, you can convert date to any format by using a combination of date and strtotime function.

Please try below format to convert date:

date(format, strtotime(originaldate))

Suppose, you have original date as mm/dd/yy (say 21/03/10) and you want to convert it to yy/mm/dd H:i:s format (say 10/03/21 00:00:00), then try below code:

$originalDate = "21/03/10";

$newDate = date("d-m-Y H:i:s", strtotime($originalDate));