hi, I am creating a record in the database, in the database field type, DateTime, but while giving data, i am using CreateDate(), instead of createdatetime(), then it is taking one day back date, but if you give create date time its taking correct/
i am in india now time is date 02/04/2024 19.00 hours,
created output in the database, is 01/04/2024 16.30 ,
but the main thing here is,while using the same value to show data on the screen, i its showing correct date
When you use DateTime() its current date with Time as 00:00.
Your platform server (and database) is running UTC and you are accessing application from IST. You have mentioned that time at your end was 02/04/2024 19.00 (IST) and since you have used DateTime() ideally 02/04/2024 00.00 (IST) should get saved in the database and its happening as intended. 02/04/2024 00.00 (IST) is 01/04/2024 6.30 PM (UTC)
( btw you have mentioned 01/04/2024 16.30 was this an oversight ?)
OutSystems applications automatically convert UTC to the client's timezone, so 01/04/2024 6:30 PM (UTC) is correctly displayed in your browser as 02/04/2024 00:00 (IST).
Hi Priya,
This is indeed a bit confusing, and has to do with the fact that a Date is nothing more than a Date Time with the time component set to 0:00. The main difference is that Date Time values are converted to UTC when they are sent to the server, and Date values are not. However, because you are assigning the output of CurrDate() (not "CreateDate()"!) to a Date Time variable, it is converted to a Date Time with time 0:00, and so is converted to UTC (which, if you are in India, is UTC+5:30). So if the current time in India is less than 5:30 hours to midnight, the value stored in the database will be that of the previous day (and some hours and a half).