strtotime() function returning incorrect date

Himani

I am getting the date of the next week even when I have set the timezone to UTC-9.

When UTC changes the day i.e 16-03-2017 00:00:00, and the UTC-9 timezone is still 15-03-2017 15:00:00, strtotime() function returns the date of the next week.

$last_time_instance = strtotime(''Wednesday' ' 16:00:00);

The variable $last_time_instance returns the time correctly, but forwards the date to the next week i.e. 22-03-17.

How can I resolve this?

mickmackusa

You can append timezone UTC-9 to the string:

$last_time_instance=strtotime('Wednesday 16:00:00 UTC-9');  // 1490803200

$time_instance_formatted=date('d-m-Y H:i:s',$last_time_instance);  // 29-03-2017 12:00:00

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 returning false date

From Dev

PHP date returning blank for Year "2090" with strtotime

From Dev

query on date returning incorrect results

From Dev

format of date string for strtotime() function in php

From Dev

format of date string for strtotime() function in php

From Dev

MACD Function Returning Incorrect Values

From Dev

PHP Function Returning Incorrect Value

From Dev

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

From Dev

strtotime('-1 month') returning wrong date if month have 31 days

From Dev

Java Date from long returning incorrect day

From Dev

SimpleDateFormat returning incorrect day on given date

From Dev

PHP: Incorrect strtotime()

From Dev

R incorrect value of date function

From Dev

Substring function in C with malloc returning incorrect value

From Dev

PHP strpos() function returning incorrect result

From Dev

Javascript returning incorrect date from an input type date

From Dev

Javascript returning incorrect date from an input type date

From Dev

Strange behavior with the strtotime function passing a wrong date and time format

From Dev

PHP date format and strtotime

From Dev

PHP strtotime returning always midnight

From Dev

TWIG date function displaying incorrect datetime

From Dev

Formating date string with strtotime and date

From Dev

The return value of function returning long long unsigned int is incorrect

From Dev

Perl's caller() function returning incorrect line number

From Dev

Returning a table from PL/SQL function - incorrect datatype

From Dev

PHP convert time strtotime working incorrect for me

From Dev

php date & strtotime function resulting in 1970-00-00 00:00 value

From Dev

PHP date conversion using strtotime

From Dev

strtotime to time issue with a specific date

Related Related

  1. 1

    strtotime returning false date

  2. 2

    PHP date returning blank for Year "2090" with strtotime

  3. 3

    query on date returning incorrect results

  4. 4

    format of date string for strtotime() function in php

  5. 5

    format of date string for strtotime() function in php

  6. 6

    MACD Function Returning Incorrect Values

  7. 7

    PHP Function Returning Incorrect Value

  8. 8

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

  9. 9

    strtotime('-1 month') returning wrong date if month have 31 days

  10. 10

    Java Date from long returning incorrect day

  11. 11

    SimpleDateFormat returning incorrect day on given date

  12. 12

    PHP: Incorrect strtotime()

  13. 13

    R incorrect value of date function

  14. 14

    Substring function in C with malloc returning incorrect value

  15. 15

    PHP strpos() function returning incorrect result

  16. 16

    Javascript returning incorrect date from an input type date

  17. 17

    Javascript returning incorrect date from an input type date

  18. 18

    Strange behavior with the strtotime function passing a wrong date and time format

  19. 19

    PHP date format and strtotime

  20. 20

    PHP strtotime returning always midnight

  21. 21

    TWIG date function displaying incorrect datetime

  22. 22

    Formating date string with strtotime and date

  23. 23

    The return value of function returning long long unsigned int is incorrect

  24. 24

    Perl's caller() function returning incorrect line number

  25. 25

    Returning a table from PL/SQL function - incorrect datatype

  26. 26

    PHP convert time strtotime working incorrect for me

  27. 27

    php date & strtotime function resulting in 1970-00-00 00:00 value

  28. 28

    PHP date conversion using strtotime

  29. 29

    strtotime to time issue with a specific date

HotTag

Archive