Help with Date Time Function

Help with Date Time Function

Just subscribed to zoho paid subscription. Thanks!

I found this post in the forum, is there an example application that uses this function? This would be really useful for my customers.

What are some good resources on how to use functions?

Trying to get it so that customers can schedule with dd mmm yyy AM/PM and have that converted to date:time that deluge understands, then be able to add one hour week ect for the end time based on their choice for calendering purposes.

Is it possible that separate Date field  and Time field  can be combined to get the date:time that deluge understands and can be used to ical events?

""Thanks to Gaev and Zoho developer friends for helping with my scheduling app.

Here is a function for anyone who is trying to do something similar--it takes times formatted as strings (such as 10:00 AM), and convert to date/time for calculation, such as adding 2 hours.

Convert string to date/time:

  1. date TextTimetoRealTime(string texttime, date newdate)
  2. {
  3.     //This function takes a time string formatted with AM/PM (ex 2:30 PM) and converts it to a real time/date.  Arguments are the source of the time string, and some date field or variable.
  4.     //RETURNS DATE ONLY IF NO AM/PM ON STRING.  
  5.     //Parse time string 
  6.     //Minutes
  7.     varMin = (input.texttime.getSuffix(":")).getPrefix(" ");
  8.     //AM/PM
  9.     varAMPM = (input.texttime.getSuffix(":")).getSuffix(" ");
  10.     //Hour (adds 12 hours if PM)
  11.     varHour = input.texttime.getPrefix(":");
  12.     if (varAMPM  ==  "PM")
  13.     {
  14.         varMilitaryHour = (varHour.toLong()  +  12);
  15.     }
  16.     else
  17.     {
  18.         varMilitaryHour = varHour.toLong();
  19.     }
  20.     //Parse real date and convert to strings
  21.     //Month
  22.     varMonth = (input.newdate.getMonth()).toString();
  23.     //Day
  24.     varDay = (input.newdate.getDay()).toString();
  25.     //Year
  26.     varYear = (input.newdate.getYear()).toString();
  27.     //Puts date and time strings in correct format for converstion to date/time
  28.     varStringDateandMilitaryTime = varMonth + "/" + varDay + "/" + varYear + " " + varMilitaryHour + ":" + varMin + ":00";
  29.     varRealDateTime = varStringDateandMilitaryTime.toTime();
  30.     return varRealDateTime;
  31.     //<comment>
  32. }

"