5

What is the right way to format xs:dateTime to RFC 822?

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
chardex
  • 323
  • 1
  • 5
  • 17

3 Answers3

5

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
2

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')
Leo
  • 37,640
  • 8
  • 75
  • 100
eze
  • 21
  • 1
0

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

Loser Coder
  • 2,338
  • 8
  • 42
  • 66