Link to home
Start Free TrialLog in
Avatar of wint100
wint100Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Check if String has a Valid Time

I have clients passing a string to my WCF Service for processing using an SQL SP. One of the parameters they pass is a String Value, which should be a DateTime in String Format. (Service does all TryParse etc..)

This must stay as it is, as other services use this which I can't change.

What I need to do is somehow Check the String server side, to see if the String has a valid time, as well as a Date, before I pass it to the SP. If it doesn't, I need to add a time of '23:59:59.997', if it has, then I leave it alone, because one the the clients has specified a Time in their request. (i.e. some clients pass '2011/2/21' other might pass '2011/2/21 14:14:00'.

The point is that sometimes a client passes a String with Date AND Time, other times the client may pass a Datetime in ShortDate format.

I can't change the client, so need to do the checking server side.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wint100

ASKER

That should do it, thanks.
NP. Glad to help  : )