guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you format date-times in RFC 3339 style?


From: sirgazil
Subject: Re: How do you format date-times in RFC 3339 style?
Date: Tue, 12 Feb 2019 09:33:27 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hi, Nala :)


El 11/02/19 a las 4:39 p. m., Nala Ginrut escribió:
Hi there!
Guile web module has provided an unexpected API for that:

(define write-date (@@ (web http) write-date))


I think I prefer using public procedures, so I'll leave the error there for now.

But I'm curious, how do you get the time zone offset using `write-date`?


> (use-modules (srfi srfi-19))
>
> (define write-date (@@ (web http) write-date))
> (call-with-output-string (lambda (port) (write-date (current-date) port)))
$1 = "Tue, 12 Feb 2019 14:23:52 GMT"

I was hoping `write-date` would write the date/time in RFC 3339 format (https://tools.ietf.org/html/rfc3339#section-5.8).


sirgazil <address@hidden <mailto:address@hidden>> 于 2019年2月12日 周二 03:18写道:

    Hi,

    I'm generating atom feeds from SXML that don't validate because of the
    date-time format I'm using:

      > (use-modules (srfi srfi-19))
      > (date->string (current-date) "~Y-~m-~dT~H:~M.~S~z")
    $1 = "2019-02-11T13:42.57-0500"

    String $1 is close to the RFC 3339 style,¹ which is the required format
    for atom feeds, but the time zone offset should be -05:00, and Guile's
    SRFI-19 ~z time zone escape is RFC 822 style, which formats the time
    zone offset as -0500.

    What should I do to get the offset in the required format?


    Thanks,


    _____

    1. http://www.faqs.org/rfcs/rfc3339.html


-- Luis Felipe López Acevedo
    http://sirgazil.bitbucket.io/




--
Luis Felipe López Acevedo
http://sirgazil.bitbucket.io/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]