c# - Converting string to DateTime safely -


I have a string that came from a database, but I'm not sure it will be a valid date time

I'm trying to validate that it is empty,

Then if I'm not empty, then I want to change it safely to datetime because I'm not sure that a line [ One "]. ToString will be a valid date time

  output.limitExpiryDate = line [" a "] == DBNull.Value? Date time.Now : "Something to convert here";   

Do anyone have any ideas?

you datetime typers :

  output.limitximetida = dateTime.Now; date timeout ExpiryDate; if (line ["a"] ! = DBBL.value and datetime. TryParse (line.field & lt; string & gt; ("A") ExpiryDate outside range) output.limitExpiryDate = limitExpiryDate;   

One tap was the appropriate datetime column which you can use to tap Types can support:

  DateTime? Range ExpiryDate = line.field & lt; DateTime? & Gt; ("a"); If (limit expired. Haas value) output. LAMID EXPIRIDDET = BORDER EXPIDIDATE. Value;    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -