2

I have used mktime() function in my code. And it prints this: Feb-12-1998. I wanna convert this something like that: 02-12-1998. But in my language it has to be 12-02-1998. Im kind of confused. Some help would be great.

echo(date("M-d-Y",mktime(0,0,0,2,12,98))."<br />"); 
FurkOk
  • 67
  • 10

4 Answers4

0
$date = 'Feb-12-1998';

echo date('m-d-Y',strtotime($date));

Output : 02-12-1998

Use this code

Hardik
  • 448
  • 2
  • 9
0

try this

echo(date("m-d-Y",mktime(0,0,0,2,12,98))."<br />"); 

https://3v4l.org/vPKbW

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

i hope it will be helpful.

Dave
  • 3,073
  • 7
  • 20
  • 33
0

use following code :

echo(date("d-m-Y",mktime(0,0,0,2,12,98)));

output : 12-02-1998

Ranjit Shinde
  • 1,121
  • 1
  • 7
  • 22
0

Instead of "M-d-Y" use "m-d-Y", it will gives you numeric date result;

Use Following code

echo date('m-d-Y',mktime(0,0,0,2,12,98)).'<br />';
sunilwananje
  • 714
  • 5
  • 17