开发者

Converting US date to Japanese

开发者 https://www.devze.com 2023-02-01 21:45 出处:网络
I am working on Multi-language site which need the date to be displayed in japanese language set. I have US date like 12-29-2010 which need to be displayed in japanese as 2010年12月29日. I am using开发

I am working on Multi-language site which need the date to be displayed in japanese language set. I have US date like 12-29-2010 which need to be displayed in japanese as 2010年12月29日. I am using开发者_运维百科 XSLT 3432 to do. Can you please let me know how I can do that.


I have to convert english date to japanese from the db, which has many different month/day/year and is updated regularly. This is just an example I have provided.

I am using XSLT and can use Javascript in it


This transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:param name="pUSDate" select="'12-29-2010 '"/>

 <xsl:template match="/">
  <xsl:value-of select=
  "concat(substring($pUSDate,7,4),
          '年',
          substring($pUSDate,1,2),
          '月',
          substring($pUSDate,4,2),
          '日'
         )
  "/>
 </xsl:template>
</xsl:stylesheet>

when applied on any XML document (not used), produces the wanted, correct result:

2010年12月29日
0

精彩评论

暂无评论...
验证码 换一张
取 消