Force a specific time in this vCalendar code...?

Kevin Smith
Kevin Smith used Ask the Experts™
on
I use the vcalendar code to send an appointment from a webform.  How do I use the code below to always have the time set to 8:00:00 am?  So if a user only puts in a date, the code will make sure the appointment is set to 8am.

' Get the start and end dates of the event (GMT).
startDateAdd = request.form("startdate")
endDate = request.form("startdate")
 
' Get a unique ID to assign to the calendar event.
uniqueID = FormatDateTime(Now()) & "-" & tmpName & "-@" &_
   Request.ServerVariables("SERVER_NAME")
 
Set file = fso.CreateTextFile(filename)
 
' Write the iCalendar file to the file system.
file.WriteLine "BEGIN:VCALENDAR"
file.WriteLine "PRODID:-//ASP iCalendar Test//My ASP App V1.0//EN"
file.WriteLine "VERSION:2.0"
file.WriteLine "METHOD:REQUEST"
file.WriteLine "BEGIN:VEVENT"
file.WriteLine "ORGANIZER:MAILTO:" & Session("MM_Username")
file.WriteLine "DTSTART:" & FormatDateTime(startDateAdd)
file.WriteLine "DTEND:" & FormatDateTime(endDate)
file.WriteLine "LOCATION:MSS"
file.WriteLine "TRANSP:OPAQUE"
file.WriteLine "SEQUENCE:0"
file.WriteLine "UID:" & uniqueID
file.WriteLine "DESCRIPTION:New Hire Start Date."
file.WriteLine "SUMMARY:New Hire Start Date"
file.WriteLine "PRIORITY:5"
file.WriteLine "CLASS:PUBLIC"
file.WriteLine "BEGIN:VALARM"
file.WriteLine "TRIGGER:-PT15M"
file.WriteLine "ACTION:DISPLAY"
file.WriteLine "END:VALARM"
file.WriteLine "END:VEVENT"
file.WriteLine "END:VCALENDAR"
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
What date format does the calendar return?

Author

Commented:
mm/mdd/yyyy hh:mm:ss  and am/pm.  It defaults the time to 12am.

Commented:
So you click on a date and time and if you don't choose a time it returns date + 12:00:00 AM?
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
  "So if a user only puts in a date, the code will make sure the appointment is set to 8am"

How are they entering the time?

Author

Commented:
I have a javascript date picker, but they also enter it manually.  All the js does it enter it into the startDateAdd field.
Commented:
You could do something like this:

if not textbox1.text.contains("AM") or not textbox1.text.contains("PM") then
   AppointmentDate = cdate(textbox1.text).toshortdatestring & " 8:00:00 AM"
end if

Author

Commented:
where would I put that?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial