Hi im using this code to export appointments from a scheduler to outlook iCal file.
The date doesnt pull through correctly
The date doesnt pull through correctly
Code:
Private Function GetAsTwoDigit(ByVal val As String) As String
If val.Length = 1 Then
Return "0" & val
Else
Return val
End If
End Function
Dim sb As New StringBuilder()
sb.AppendLine("BEGIN: VCALENDAR")
sb.AppendLine("BEGIN: VEVENT")
Dim date_start As Date = txtLocation.Text
Dim date_timeStart As Date = txtLocation.Text
sb.AppendLine(String.Format("DTSTART:{0}{1}{2}T{3}{4}00Z", Year(date_start).ToString, GetAsTwoDigit(Month(date_start).ToString), GetAsTwoDigit(Day(date_start).ToString), GetAsTwoDigit(Hour(date_start).ToString), GetAsTwoDigit(Minute(date_start).ToString)))
Dim date_end As Date = txtLocation.Text
Dim date_timeEnd As Date = txtLocation.Text
sb.AppendLine(String.Format("DTEND:{0}{1}{2}T{3}{4}00Z", Year(date_end).ToString, GetAsTwoDigit(Month(date_end).ToString), GetAsTwoDigit(Day(date_end).ToString), GetAsTwoDigit(Hour(date_end).ToString), GetAsTwoDigit(Minute(date_end).ToString)))
MsgBox(sb.ToString)
sb.AppendLine(String.Format("LOCATION;ENCODING=QUOTED-PRINTABLE:{0}", txtLocation.Text))
sb.AppendLine("UID: FD7D9F229CAE422AA76738B77044DA9659A83")
sb.AppendLine(String.Format("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:{0}", txtDescription.Text))
sb.AppendLine(String.Format("SUMMARY;ENCODING=QUOTED-PRINTABLE:{0}", txtSummary.Text))
sb.AppendLine(String.Format("PRIORITY:{0}", txtPriority.Text))
sb.AppendLine("End : VEVENT")
sb.AppendLine("End : VCALENDAR")
Return sb.ToString
Comment