|
-
April 25th, 2010, 09:01 AM
#1
Determine the format a 'date' string
Hello,
I was wondering if there is an easy way to determine the date format of a string with a date.
"19-03-1983" to "dd-MM-yyyy"
"19-03-1983" to "dd-MM-yy"
Is there a function that supports this or do I have to write such a function myself?
-
April 25th, 2010, 06:20 PM
#2
Re: Determine the format a 'date' string
As far as I know, you can parse it into a DateTime and then act on it, but if you need to determine what the original format was, you'd have to code it.
-
April 26th, 2010, 01:44 AM
#3
Re: Determine the format a 'date' string
It cannot be determinet, it can be just estimated. Imagine date 1-2-2010. Is it the first february, or the second january? How could you decide it? Data formats must be agreed prior to working with them.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
April 26th, 2010, 07:12 AM
#4
Re: Determine the format a 'date' string
Take a look at System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|