开发者

Saxon XSLT 2.0 and RFC 822 date format

开发者 https://www.devze.com 2023-01-19 16:40 出处:网络
What is the right way to format xs:dateTime to RFC 8开发者_运维知识库22?You need fn:format-dateTime

What is the right way to format xs:dateTime to RFC 8开发者_运维知识库22?


You need fn:format-dateTime

I think it should be:

format-dateTime(current-dateTime(),
                '[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z]',
                'en',
                '',
                'US')

Right now, for me, output:

Thu, 07 Oct 2010 21:10:03 -03:00


Yup. I added 'AD' as the calendar and that cleaned up the output using SaxonHE 9.3.0.5

fn:format-dateTime(current-dateTime(),
            '[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z]',
            'en',
            'AD',
            'US')


In XSL:

<xsl:value-of select="concat(ms:format-date(InputDate, 'ddd, dd MMM yyyy'), ' ', ms:format-time(InputDate, 'HH:mm:ss'), ' EST')"/>

When date was retrieved from database as:

 SELECT
      Table.DateField AS InputDate
    FROM Table 

or try : SELECT CONVERT(NVARCHAR(10), Table.DateField, 101) AS InputDate FROM Table

0

精彩评论

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