Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datetimeconverter
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Datetimeconverter
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01330393
Message ID:
01330393
Vues:
74
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform