Click here to Skip to main content
15,867,851 members
Home / Discussions / C#
   

C#

 
AnswerRe: Datetime parsing Pin
Richard MacCutchan5-Aug-13 22:58
mveRichard MacCutchan5-Aug-13 22:58 
GeneralRe: Datetime parsing Pin
ExcellentOrg5-Aug-13 23:30
ExcellentOrg5-Aug-13 23:30 
AnswerRe: Datetime parsing Pin
Richard MacCutchan6-Aug-13 0:04
mveRichard MacCutchan6-Aug-13 0:04 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 9:19
ExcellentOrg6-Aug-13 9:19 
AnswerRe: Datetime parsing Pin
Richard MacCutchan6-Aug-13 0:09
mveRichard MacCutchan6-Aug-13 0:09 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 9:10
ExcellentOrg6-Aug-13 9:10 
AnswerRe: Datetime parsing Pin
Mycroft Holmes6-Aug-13 12:56
professionalMycroft Holmes6-Aug-13 12:56 
GeneralRe: Datetime parsing Pin
ExcellentOrg6-Aug-13 18:52
ExcellentOrg6-Aug-13 18: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 7:57
ExcellentOrg7-Aug-13 7:57 
QuestionHow to convert string to form object in c# window application Pin
susanna.floora5-Aug-13 21:37
susanna.floora5-Aug-13 21:37 
AnswerRe: How to convert string to form object in c# window application Pin
ExcellentOrg5-Aug-13 22:34
ExcellentOrg5-Aug-13 22:34 
AnswerRe: How to convert string to form object in c# window application Pin
Rizny Mubarak5-Aug-13 23:43
Rizny Mubarak5-Aug-13 23:43 
QuestionRe: How to convert string to form object in c# window application Pin
Eddy Vluggen6-Aug-13 7:47
professionalEddy Vluggen6-Aug-13 7:47 
AnswerRe: How to convert string to form object in c# window application Pin
susanna.floora7-Aug-13 19:07
susanna.floora7-Aug-13 19:07 
AnswerRe: How to convert string to form object in c# window application Pin
ExcellentOrg6-Aug-13 9:22
ExcellentOrg6-Aug-13 9:22 
AnswerRe: How to convert string to form object in c# window application Pin
Jean A Brandelero8-Aug-13 10:45
Jean A Brandelero8-Aug-13 10:45 
GeneralRe: How to convert string to form object in c# window application Pin
susanna.floora9-Aug-13 2:02
susanna.floora9-Aug-13 2:02 
GeneralRe: How to convert string to form object in c# window application Pin
Jean A Brandelero9-Aug-13 7:51
Jean A Brandelero9-Aug-13 7:51 
AnswerRe: How to convert string to form object in c# window application Pin
BillWoodruff11-Aug-13 0:13
professionalBillWoodruff11-Aug-13 0:13 
GeneralRe: How to convert string to form object in c# window application Pin
susanna.floora26-Aug-13 21:47
susanna.floora26-Aug-13 21:47 
QuestionAutocomplete TextBox no find other words in string Pin
juliogyn5-Aug-13 16:49
juliogyn5-Aug-13 16:49 
AnswerRe: Autocomplete TextBox no find other words in string Pin
Abhinav S5-Aug-13 17:07
Abhinav S5-Aug-13 17:07 
GeneralRe: Autocomplete TextBox no find other words in string Pin
juliogyn5-Aug-13 18:08
juliogyn5-Aug-13 18:08 
AnswerRe: Autocomplete TextBox no find other words in string Pin
Abhinav S5-Aug-13 18:31
Abhinav S5-Aug-13 18:31 
GeneralRe: Autocomplete TextBox no find other words in string Pin
juliogyn6-Aug-13 9:18
juliogyn6-Aug-13 9: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.