Click here to Skip to main content
15,561,817 members
Home / Discussions / C#
   

C#

 
AnswerRe: Datetime parsing Pin
Richard MacCutchan5-Aug-13 23:58
mveRichard MacCutchan5-Aug-13 23:58 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 0:30
ExcellentOrg6-Aug-13 0:30 
AnswerRe: Datetime parsing Pin
Richard MacCutchan6-Aug-13 1:04
mveRichard MacCutchan6-Aug-13 1:04 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 10:19
ExcellentOrg6-Aug-13 10:19 
AnswerRe: Datetime parsing Pin
Richard MacCutchan6-Aug-13 1:09
mveRichard MacCutchan6-Aug-13 1:09 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 10:10
ExcellentOrg6-Aug-13 10:10 
AnswerRe: Datetime parsing Pin
Mycroft Holmes6-Aug-13 13:56
professionalMycroft Holmes6-Aug-13 13:56 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 19:52
ExcellentOrg6-Aug-13 19:52 
Mycroft Holmes wrote:
I would address this a different way, assuming each stream is identifiable and is internally consistent, I would register a format for each source.


They are consistent in a sense that if mm was before dd, it does seem to remain that way ... but I'd be in trouble if I assume that it will always be slash / between characters. Sometimes it is dash or space too. So, I weed out all unwanted characters using String.Replace and replace them with what slashes as I have
'em on my format string before even attempting to parse the date.

Further, I do have custom attribute defined for each and every date/time field which essentially leads to one of the eight format strings as "tryFirstFormat". So, yes! I do have one format registered for each field although I know that expecting it to remain consistent is a bit-too-much at this point in time....

In the code, before the loop, I use parseExact to parse the date. Naturally that too is in its own try-catch block. Only if that fails, code will enter the loop.

I did not post all of the above code assuming that more code will confuse people and felt that it was not relevant to problem. But it seems from the early responses that partial code is confusing ppl more.

modified 7-Aug-13 1:02am.

AnswerRe: Datetime parsing Pin
ExcellentOrg7-Aug-13 8:57
ExcellentOrg7-Aug-13 8:57 
QuestionHow to convert string to form object in c# window application Pin
susanna.floora5-Aug-13 22:37
susanna.floora5-Aug-13 22:37 
AnswerRe: How to convert string to form object in c# window application Pin
ExcellentOrg5-Aug-13 23:34
ExcellentOrg5-Aug-13 23:34 
AnswerRe: How to convert string to form object in c# window application Pin
Rizny Mubarak6-Aug-13 0:43
Rizny Mubarak6-Aug-13 0:43 
QuestionRe: How to convert string to form object in c# window application Pin
Eddy Vluggen6-Aug-13 8:47
professionalEddy Vluggen6-Aug-13 8:47 
AnswerRe: How to convert string to form object in c# window application Pin
susanna.floora7-Aug-13 20:07
susanna.floora7-Aug-13 20:07 
AnswerRe: How to convert string to form object in c# window application Pin
ExcellentOrg6-Aug-13 10:22
ExcellentOrg6-Aug-13 10:22 
AnswerRe: How to convert string to form object in c# window application Pin
Jean A Brandelero8-Aug-13 11:45
Jean A Brandelero8-Aug-13 11:45 
GeneralRe: How to convert string to form object in c# window application Pin
susanna.floora9-Aug-13 3:02
susanna.floora9-Aug-13 3:02 
GeneralRe: How to convert string to form object in c# window application Pin
Jean A Brandelero9-Aug-13 8:51
Jean A Brandelero9-Aug-13 8:51 
AnswerRe: How to convert string to form object in c# window application Pin
BillWoodruff11-Aug-13 1:13
professionalBillWoodruff11-Aug-13 1:13 
GeneralRe: How to convert string to form object in c# window application Pin
susanna.floora26-Aug-13 22:47
susanna.floora26-Aug-13 22:47 
QuestionAutocomplete TextBox no find other words in string Pin
juliogyn5-Aug-13 17:49
juliogyn5-Aug-13 17:49 
AnswerRe: Autocomplete TextBox no find other words in string Pin
Abhinav S5-Aug-13 18:07
Abhinav S5-Aug-13 18:07 
GeneralRe: Autocomplete TextBox no find other words in string Pin
juliogyn5-Aug-13 19:08
juliogyn5-Aug-13 19:08 
AnswerRe: Autocomplete TextBox no find other words in string Pin
Abhinav S5-Aug-13 19:31
Abhinav S5-Aug-13 19:31 
GeneralRe: Autocomplete TextBox no find other words in string Pin
juliogyn6-Aug-13 10:18
juliogyn6-Aug-13 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.