-2

In a form i have given type ="date", By default iam getting date format as dd-mm-yyyy. How can i change the format to yyyy-mm-dd. below is the sample code, Please help me on this

1 Answers1

-3

Use PHP strtotime() function to convert. Let Suppose you will get

<?php

$date1 = "20-12-2018";

//now convert it using the strtotime function

$date2 = date('Y-m-d',strtotime($date1));

Read Full Documentation Here

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
TarangP
  • 2,711
  • 5
  • 20
  • 41