-2

in date input i have : Y/m/d (output:2013/12/1) now for insert to MySql databse timestamp i need to change this to this format : m,d,Y (output:12,1,2013).

I replace / with , using str_replcae:

str_replace('/', ",", $_POST['timepub']);

this output is: 2013,12,1 how do change to 12,1,2013 ?!

EDIT: I need to this for mktime costum function not in strtotime.

Pink Code
  • 1,802
  • 7
  • 43
  • 65

2 Answers2

1

Try

echo date('m,d,Y',strtotime('2013/12/1'));
Nouphal.M
  • 6,304
  • 1
  • 17
  • 28
1

See below link for more info

Convert date format yyyy-mm-dd => dd-mm-yyyy

Community
  • 1
  • 1
Nirav Patel
  • 432
  • 6
  • 19