1

i would like to change my french date Jeudi, 22 Août 2013 to timestamp.

i've tried thing like this but it didin't work

ladate = new Date("F j, Y...","Jeudi, 22 Août 2013");
echo $ladate;
Yassine edouiri
  • 281
  • 3
  • 14
  • 30

1 Answers1

1

You could use strptime() to work with localized date formats; it returns an array of information that you can use with mktime() to create a timestamp:

setlocale(LC_ALL, 'fr_FR');

$date = 'Jeudi, 22 Août 2013';

$a = strptime($date, '%A, %d %B %Y');
$timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year'] + 1900);
// int(1377129600)

However, it's not implemented in Windows; you may need to resort to the intl extension or replace day and month names into English :)

Ja͢ck
  • 170,779
  • 38
  • 263
  • 309