c# - DateTime.TryParseExact not parsing -


i have datetime string , trying parse datetime object, not working. 2 datetime objects never have values set. i'm sure it's simple i'm not seeing. see wrong code?

string issued = "tue 25 jul 2017 16:47:38"; string expires = "tue 25 jul 2017 18:47:38";  string format = "ddd dd mmm yyyy hh:mm:ss"; datetime dissued; datetime dexpires; datetime.tryparseexact(issued, format, cultureinfo.invariantculture, datetimestyles.none, out dissued); datetime.tryparseexact(expires, format, cultureinfo.invariantculture, datetimestyles.none, out dexpires); 

i ran code , seemed work fine. i'm assuming you're hard coding strings exemplary sake. consider putting break statement @ point in code 2 values filled , inspecting them see content. excess whitespace or chars throw error.

try .trim(); on string too. removes white space @ beginning , end of string transform string so:

" cat " -> "cat"


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -