strtotime is not working proper in php for future date?

Bhavesh Patel

When i am converting date from d-m-Y in Y-m-d format. i am facing some issues for it.

example 19/08/1989 will convert into 1989/08/19 (it's correct),

19/08/2059 will convert into 1970/01/01 (it's not correct)

$re_date = date('Y-m-d', strtotime($_POST['re_date']));

Help me please. thanks in advance.

Rahul Tripathi

The maximum date allowed is Tue, 19 Jan 2038 03:14:07 UTC on 32 bit system

From the strotime docs:

Note:

The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC.

If you want it to work for 32 bit system then try like this using DateTime:

$date = new DateTime($_POST['re_date']);

echo $date->format('Y-m-d');

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

strtotime is not working proper in php for future date?

From Dev

PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

From Dev

PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

From Dev

PHP date format and strtotime

From Dev

PHP strtotime not working with while array

From Dev

PHP date conversion using strtotime

From Dev

Formatting date using PHP strtotime

From Dev

Check a date interval with strtotime in php

From Dev

PHP strtotime conversion not working for some datetimes

From Dev

PHP convert time strtotime working incorrect for me

From Dev

format of date string for strtotime() function in php

From Dev

String date to time in PHP - strtotime "loses hours"

From Dev

PHP date & strtotime adding 12 minutes?

From Dev

PHP Converting Integer to Date, reverse of strtotime

From Dev

PHP: Add some milliseconds to a date() with strtotime()

From Dev

PHP strtotime() "noon" must go before date

From Dev

PHP strtotime() with date() issue with year field

From Dev

Php: Change language in date/strftime/strtotime

From Dev

PHP: strtotime revered return strange date?

From Dev

PHP: Add some milliseconds to a date() with strtotime()

From Dev

PHP date returning blank for Year "2090" with strtotime

From Dev

format of date string for strtotime() function in php

From Dev

how to overwrite date to 1st of month php strtotime and date

From Dev

PHP strtotime error when convert some date string to datetime value

From Dev

PHP parse date with Timezone+Offset using strtotime()

From Dev

STRTOTIME to find current week, date for Monday and Saturday, PHP

From Dev

Using strtotime() PHP and revert back trough gmdate() is not returning same date

From Dev

STRTOTIME take date and data from mysql and concatenate them on php

From Dev

Using Moment.js like PHP's date and strtotime

Related Related

  1. 1

    strtotime is not working proper in php for future date?

  2. 2

    PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

  3. 3

    PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

  4. 4

    PHP date format and strtotime

  5. 5

    PHP strtotime not working with while array

  6. 6

    PHP date conversion using strtotime

  7. 7

    Formatting date using PHP strtotime

  8. 8

    Check a date interval with strtotime in php

  9. 9

    PHP strtotime conversion not working for some datetimes

  10. 10

    PHP convert time strtotime working incorrect for me

  11. 11

    format of date string for strtotime() function in php

  12. 12

    String date to time in PHP - strtotime "loses hours"

  13. 13

    PHP date & strtotime adding 12 minutes?

  14. 14

    PHP Converting Integer to Date, reverse of strtotime

  15. 15

    PHP: Add some milliseconds to a date() with strtotime()

  16. 16

    PHP strtotime() "noon" must go before date

  17. 17

    PHP strtotime() with date() issue with year field

  18. 18

    Php: Change language in date/strftime/strtotime

  19. 19

    PHP: strtotime revered return strange date?

  20. 20

    PHP: Add some milliseconds to a date() with strtotime()

  21. 21

    PHP date returning blank for Year "2090" with strtotime

  22. 22

    format of date string for strtotime() function in php

  23. 23

    how to overwrite date to 1st of month php strtotime and date

  24. 24

    PHP strtotime error when convert some date string to datetime value

  25. 25

    PHP parse date with Timezone+Offset using strtotime()

  26. 26

    STRTOTIME to find current week, date for Monday and Saturday, PHP

  27. 27

    Using strtotime() PHP and revert back trough gmdate() is not returning same date

  28. 28

    STRTOTIME take date and data from mysql and concatenate them on php

  29. 29

    Using Moment.js like PHP's date and strtotime

HotTag

Archive