Calculate Hours Minutes Sec in Zoho Creator Using Deluge

Calculate Hours Minutes Sec in Zoho Creator Using Deluge



  1. check_In = "8-Aug-2023 10:00:00".toDateTime().toLong();
  2. checkout = "8-Aug-2023 18:00:00".toDateTime().toLong();
  3. //difference = start.timeBetween(end);
  4. check_In = "8-Aug-2023 17:56:50".toDateTime().toLong();
  5. checkout = "8-Aug-2023 18:00:00".toDateTime().toLong();
  6. v_UnixSeconds = checkout - check_In;
  7. info v_UnixSeconds;
  8. info v_UnixSeconds;
  9. v_Days = floor((((v_UnixSeconds / 1000) / 60) / 60) / 24);
  10. v_Days = floor(v_UnixSeconds / 86400000);
  11. info v_Days;
  12. info v_UnixSeconds;
  13. v_UnixSeconds = v_UnixSeconds - v_Days * 1000 * 60 * 60 * 24;
  14. info v_UnixSeconds;
  15. v_Hours = floor(((v_UnixSeconds / 1000) / 60) / 60);
  16. info v_Hours;
  17. v_UnixSeconds = v_UnixSeconds - v_Hours * 1000 * 60 * 60;
  18. v_Minutes = floor((v_UnixSeconds / 1000) / 60);
  19. info v_Minutes;
  20. v_UnixSeconds = v_UnixSeconds - v_Minutes * 1000 * 60;
  21. v_Seconds = floor(v_UnixSeconds / 1000);
  22. info v_Seconds;
  23. //
  24. v_DayGrammar = if(v_Days == 1,"DAY","DAYS");
  25. v_HourGrammar = if(v_Hours == 1,"HR","HRS");
  26. v_MinGrammar = if(v_Minutes == 1,"MIN","MINS");
  27. v_SecGrammar = if(v_Seconds == 1,"SEC","SECS");
  28. //
  29. info v_Days + " " + v_DayGrammar + ", " + v_Hours + " " + v_HourGrammar + ", " + v_Minutes + " " + v_MinGrammar + ", " + v_Seconds + " " + v_SecGrammar;