Tuesday, September 20, 2005

LCID Chart

Hi Guys

I was playing around customizing a look and feel of a Data View web part. The web part was reading data from a list and displaying the information. It contains a Date Time column that was displaying its information in American date formate. As display below,

select="ddwrt:FormatDate(string(@ows_EventDate), 1033, 1)

1033 stand for US English and end result was 09/22/2005 (mm/dd/yy)

I needed to change this to display Australian Date and Time format as dd/mm/yy. So I was looking for the LCID of Australian English and found out fallowing usefull article that display most LCID’s.

Changing the, Date, Time, and Currency Format

I end up changing the above code to fallowing to achive my requirement

select="ddwrt:FormatDate(string(@ows_EventDate), 3081, 1)

End result look like 22/09/2005

3 Comments:

At 5:59 PM, Anonymous Anonymous said...

Setting the LCID is hardcoding the locale. The regional settings for a site can be changed in site settings. Do you know of any way to format dates so that the format changes whenever the locale is changed in site settings?

 
At 1:56 PM, Anonymous Anonymous said...

Hi Gayan,

Good work at Tech Ed this year.

Obviously this is an old post, but it's on-topic:

I’ve a DataView WebPart displaying dates in US format despite the Regional Settings for the site being in English (Australian) – any quick fixes?

Digging deeper, this is XSLT that displays the date:

xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@DueDate),number($Language),1)"

Is seems the $Language XSL Parameter isn’t being set properly – anyone know where it’s set? (I notice it’s part of the Parameter Bindings: ParameterBinding Name="Language" Location="Postback;Connection;CAMLVariable"... but I’m not sure where it’d be looking for the value).

Cheers.

 
At 12:06 PM, Anonymous Anonymous said...

Awaesome thanks for that, just solved a massive problem for me.
Even though I have the Regional Settings set to Oz each time a user went into the dispform it was showing as yank.

Thansk a bunch

 

Post a Comment

<< Home