Probably there is something wrong with
Fields!Date.Value
.
Try something similar:
DateTime dateValue;
if (DateTime.TryParse(Fields!Date.Value, out dateValue))
return dateValue.ToString("yyyy/MM/dd h:mm:ss tt")
else
return "n/a";
Let us know!
Cheers
EDIT:
I just tried the following code:
string printableString;
DateTime dateValue;
if (DateTime.TryParse("22-08-2010 14:57:33", out dateValue))
printableString = dateValue.ToString("yyyy/MM/dd h:mm:ss tt");
else
printableString = "n/a";
And the result is
2010-08-22 2:57:33
as expected.
If I try to enter the wrong input as
DateTime.TryParse("25-25-2010 14:57:33", out dateValue)
I get
n/a
as the result.
If you show me some more code, maybe we can find a proper solution.
Bye