How to Get Short Date Format Pattern?

  • Thread starter Thread starter Ellis Yu
  • Start date Start date
E

Ellis Yu

Dear All

I want to read the short date format pattern from the regional
setting. I write a code as follow:

'Diff. machine may has different country setting, so I use blank
here
Dim a as new CultureInfo("")
Dim shortDatePattern as String

shortDatePattern = a.DateTimeFormat.ShortDatePattern()

But I found that the pattern is different to my regional setting one. Anyone
know how to do? Thanks

Best Rdgs
Ellis
 
Hi,

http://msdn.microsoft.com/library/d...etimeformatinfoclassshortdatepatterntopic.asp

Ken
---------------
Dear All

I want to read the short date format pattern from the regional
setting. I write a code as follow:

'Diff. machine may has different country setting, so I use blank
here
Dim a as new CultureInfo("")
Dim shortDatePattern as String

shortDatePattern = a.DateTimeFormat.ShortDatePattern()

But I found that the pattern is different to my regional setting one. Anyone
know how to do? Thanks

Best Rdgs
Ellis
 
Ellis,
'Diff. machine may has different country setting, so I use blank
here
But I found that the pattern is different to my regional setting one.
Anyone
know how to do? Thanks

You make me curious, how do you do that?

Even if I would use a device to find the location by satalite, than I did
not know the culture of the user.

Cor
 
Thanks Ken, maybe I didn't explain clear enough of my problem. I want to get
the short time format pattern from regional setting. Since the pattern maybe
changed by the user, it's different to the default pattern. Just like the
sample you given to me, if the culture is "en-US", then the short format
will be "M/d/yyyy" even the user had used his customized format instead. If
in that case, how can I do?
 
Ellis Yu said:
Dim a as new CultureInfo("")
Dim shortDatePattern as String

shortDatePattern = a.DateTimeFormat.ShortDatePattern()

But I found that the pattern is different to my regional setting one.
Anyone
know how to do? Thanks

Try this:

\\\
Imports System.Globalization
..
..
..
MsgBox(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern)
///
 
Hi,

Dim myDTFI As DateTimeFormatInfo =
Globalization.CultureInfo.CurrentCulture.DateTimeFormat



Ken

---------------------------

Thanks Ken, maybe I didn't explain clear enough of my problem. I want to get
the short time format pattern from regional setting. Since the pattern maybe
changed by the user, it's different to the default pattern. Just like the
sample you given to me, if the culture is "en-US", then the short format
will be "M/d/yyyy" even the user had used his customized format instead. If
in that case, how can I do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top