Closed salehattari closed 17 hours ago
Can you provide some examples?
If you look carefully at the pictures, you will see that the current time in Iran is 9:18 AM, but the time that the library returns is 7:48 AM! In another image, I have shown you the code that led to this output for a closer look.
did you set timezone to 'Asia/Tehran'?
No! I hadn't done this because I thought the library did this by default.
Important to all friends who have encountered my problem: I was able to fix the problem globally in my project by using the date_default_timezone_set function and setting the time zone to 'Asia/Tehran'.
@morilog Thanks for the tip
The final php code that fixed my problem:
date_default_timezone_set('Asia/Tehran');
Hello. When I use the 'now' method and convert the returned data from the library to a DateTime, the output shows a time that differs from the current time by more than one hour. This could become problematic for larger projects!