-1

Hello i want to convert date to another format. below is what i tried and did not work:

    $expirationdate = 22nd November 2021;
    $newDate = date("'d\<\s\u\p\>S\<\/\s\u\p\> F Y", strtotime($expirationdate));  

Thanks

Landry
  • 137
  • 11

1 Answers1

0

changr dateformat F to M

$expirationdate = '22nd November 2021';
echo $newDate = date('d M Y', strtotime($expirationdate));

if you need '22nd'

echo $newDate = date('dS M Y', strtotime($expirationdate));
Rp9
  • 1,955
  • 2
  • 23
  • 31
  • it did not work. it abbreviates the month but gives wrong date. please take note of the format which is not standard: 22nd November 2021 – Landry Nov 22 '19 at 16:18