Apr
16
Written by:
Steve Gray
4/16/2010 11:08 AM
I recently upgraded a project to the ComponentArt 2009.1 calendar control, because I needed access to the time as well as the date, 2008 didn’t support that.
I have a complicated web form that looks at the parameters in a Crystal report and drops them on the form dynamically. For date params, I add the ComponentArt calendar control.
My code looked at the Request object and converted the value provided to a date. The 2009 control’s value is in the form of “2010.12.31.0.0.0” and that value won’t convert (easily) to a datetime object. Here’s my solution.
Code Snippet
- Imports System.Globalization
Code Snippet
- Dim dtDate As DateTime = DateTime.ParseExact(Request(strFieldName), "yyyy.M.d.h.m.s", CultureInfo.InvariantCulture)
This doesn’t look too hard… but it took about three hours to figure it out. You owe me.
As always, I welcome your comments!