0

When enter date 31-06 in jalali year (for example 1397-06-31) to php date function, the output shows one day after that!

<?php
$date = date_create('1397-06-31');
echo date_format($date, 'Y-m-d');
// the output is 1397-07-01
?>

How i can fix it?

Biqarar
  • 195
  • 1
  • 6
  • 1
    PHP doesn't understand jalali dates. You will need to use a package such as https://github.com/morilog/jalali to process them. – Nick Dec 07 '18 at 20:10

1 Answers1

1

You didn't enter a Jalali date, you entered a date ~600 years ago.

June 31st didn't exist that year in your timezone, which is why it skips one day ahead.

Evert
  • 93,428
  • 18
  • 118
  • 189