Link to home
Start Free TrialLog in
Avatar of Kevin Smith
Kevin SmithFlag for United States of America

asked on

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

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"
Avatar of Rick
Rick

What date format does the calendar return?

Avatar of Kevin Smith

ASKER

mm/mdd/yyyy hh:mm:ss  and am/pm.  It defaults the time to 12am.
So you click on a date and time and if you don't choose a time it returns date + 12:00:00 AM?
  "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?

I have a javascript date picker, but they also enter it manually.  All the js does it enter it into the startDateAdd field.
ASKER CERTIFIED SOLUTION
Avatar of Rick
Rick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
where would I put that?