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:
- date TextTimetoRealTime(string texttime, date newdate)
- {
- //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.
- //RETURNS DATE ONLY IF NO AM/PM ON STRING.
- //Parse time string
- //Minutes
- varMin = (input.texttime.getSuffix(":")).getPrefix(" ");
- //AM/PM
- varAMPM = (input.texttime.getSuffix(":")).getSuffix(" ");
- //Hour (adds 12 hours if PM)
- varHour = input.texttime.getPrefix(":");
- if (varAMPM == "PM")
- {
- varMilitaryHour = (varHour.toLong() + 12);
- }
- else
- {
- varMilitaryHour = varHour.toLong();
- }
- //Parse real date and convert to strings
- //Month
- varMonth = (input.newdate.getMonth()).toString();
- //Day
- varDay = (input.newdate.getDay()).toString();
- //Year
- varYear = (input.newdate.getYear()).toString();
- //Puts date and time strings in correct format for converstion to date/time
- varStringDateandMilitaryTime = varMonth + "/" + varDay + "/" + varYear + " " + varMilitaryHour + ":" + varMin + ":00";
- varRealDateTime = varStringDateandMilitaryTime.toTime();
- return varRealDateTime;
- //<comment>
- }
"