Date Formats in different cultures

  • Thread starter Thread starter Mohamamd Areef
  • Start date Start date
M

Mohamamd Areef

Hello,

I am using Arabic-SaudiArabia(ar-sa) culture in my
application.For the ar-sa culture the date format as
mentioned by Windows2000 OS is dd/MM/yyyy.But, where as
in .Net when we use the same culture we get the dates in
the format dd/MM/yy.Can any one tell me, whether I am
missing somehting or there is some problem with the
FrameWork.

I am using 1.0 Framework.

Regards,
Areef.
 
Areef,

First, try to use the appropriate fixed date/time format string and supply
it to the ToString() method.

If the following does not help you, read on. One of the overloads of the
CultureInfo constructor accepts a boolean parameter named useUserOverride.
Try to construct an instance of the CultureInfo class by using "ar-SA" as
the specific culture name and set the "useUserOverride" parameter value to
true. Then use the created CultureInfo instance to format dates. You might
also clone a DateTimeFormatInfo instance from current CultureInfo and
customize it to enable the long year pattern.
 
Alsalam Alikom,
you can use the custom format on the datetime picker control or you can
even inherit from the datetime picker control for a RTL application for
imaging. Then in the underlaying level you use the ansi standard
datetime format which is DateTime.ToString("s") or
DateTime.ToString("yyyy.MM.dd") ... you can even cast them again to
DateTime to return an ansi standard DateTime data type.

N.B. the DateTimePicker control **Format** property had to be adjusted
otherwise you will always face the same problem cause mostly you are
using the deafult short format.
 
Back
Top