I am going through a weird situation in a Laravel inertia application. I am not understanding where the problem actually is. For example when I'm passing
date : 2022-04-27
when I try to insert in the table at 12AM - 12:59AM in mid night automatically date changes to
date : 2022-04-26
In other time it is working perfectly. only the time between 12:00AM to 12:59AM. Please let me know where I'm going wrong.
@shariff There is a difference between timestamp and date
DATETIME vs TIMESTAMP
The biggest difference between these are how far back in time you can go. DATETIME can be set to the first of January of year 1000 while TIMESTAMP start from the first of January 1970. TIMESTAMP has an upper limit of 2038 while DATETIME has the upper limit of 9999. The TIMESTAMP has a higher precision, and takes consideration of the current timezone while DATETIME doesn't.
So try changing to timestamp insead of date, if you care about the timezone.
@Tray2 yeah I'm using date data type for storing date. I just saw created_at and updated_at column of reservation table at what the time the date is getting changed. During this timestamp 2022-04-27 00:18:42 it is saving as previous date