AddHour resets the time to 00:00:00 before adding the hour.
Based on the documentation here:
https://www.zoho.com/deluge/help/functions/datetime/addhour.html
Here's my custom function:
- string ConvertDateFormat(string inputDate)
- {
- // Extract only the date-time part (before the timezone)
- dateTimePart = inputDate.subString(0,19);
- // Replace 'T' with a space to match "yyyy-MM-dd HH:mm:ss" format
- formattedDateTime = dateTimePart.replaceAll("T"," ");
- // Convert to a Deluge date-time object without losing the time
- parsedDateTime = formattedDateTime.toDate("yyyy-MM-dd HH:mm:ss");
- // Add 1 hour
- adjustedDateTime = parsedDateTime.addHour(1);
- // Format back to "yyyy-MM-dd HH:mm:ss"
- finalFormattedDate = adjustedDateTime.toString("yyyy-MM-dd HH:mm:ss");
- return finalFormattedDate;
- }
Input is this:
- {
- "inputDate": "2025-04-30T11:30:00+10:00Z"
- }
But output looks like this:
{
"followUpDate_4": "2025-04-30 01:00:00"
}
Expected output should be 12:30 PM instead of 01:00 AM