AddHour resets the time to 00:00:00 before adding the hour.

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:
  1. string ConvertDateFormat(string inputDate)
  2. {
  3. // Extract only the date-time part (before the timezone)
  4. dateTimePart = inputDate.subString(0,19);
  5. // Replace 'T' with a space to match "yyyy-MM-dd HH:mm:ss" format
  6. formattedDateTime = dateTimePart.replaceAll("T"," ");
  7. // Convert to a Deluge date-time object without losing the time
  8. parsedDateTime = formattedDateTime.toDate("yyyy-MM-dd HH:mm:ss");
  9. // Add 1 hour
  10. adjustedDateTime = parsedDateTime.addHour(1);
  11. // Format back to "yyyy-MM-dd HH:mm:ss"
  12. finalFormattedDate = adjustedDateTime.toString("yyyy-MM-dd HH:mm:ss");
  13. return finalFormattedDate;
  14. }
Input is this:
  1. {
  2. "inputDate": "2025-04-30T11:30:00+10:00Z"
  3. }
But output looks like this:
  1. {
    "followUpDate_4": "2025-04-30 01:00:00"
  2. }

Expected output should be 12:30 PM instead of 01:00 AM