Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetimeconverter
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Datetimeconverter
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01330393
Message ID:
01330393
Views:
72
I would like to convert a date string to a datetime value. I found a thread on doing that using DateTime.TryParse and that works fine. However, I would like to know why I can't get the datetimeconverter to work. Here's what I tried. I always ended up with a date time value of 1/1/0001. Although I have shown hard-coded strings here, in my test, I was using strings passed as parameters and used paramstring.ToString() for the string value, if that makes any difference. Thanks.
            DateTime dtBegDate;
            DateTime dtEndDate;
            string dstrBegDate = '1/1/2006';
            string dstrEndDate = '12/31/2006';
            TypeDescriptor.GetConverter(dtBegDate).ConvertFrom(dstrBegDate);
            TypeDescriptor.GetConverter(dtEndDate).ConvertFrom(dstrEndDate);
Linda Harmes
HiBit Technologies, Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform