unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Guy Baumann <guy@gammarus.co.uk>
To: guile-user@gnu.org
Subject: Help formatting a UTC Timestamp
Date: Tue, 14 Feb 2017 12:27:16 +0000	[thread overview]
Message-ID: <20170214122716.GA2454@debian> (raw)

I am trying to format a timestamp from an api. It is sent in the
 format "2011-03-24T20:30:47Z"

what I want to output is something like this
(strftime "%d %b %g " (localtime (current-time)) )

However I am unable to work out how to do this, have tried using
 string->date with results below

Enter `,help' for help.
scheme@(guile-user)> (define date "2011-03-24T20:30:47Z")
scheme@(guile-user)> (use-modules (srfi srfi-19))
scheme@(guile-user)> (string->date "~Y-m-dT~H:~M:SZ" date)
srfi/srfi-19.scm:1415:18: In procedure priv:string->date:
srfi/srfi-19.scm:1415:18: In procedure string->date: TIME-ERROR type bad-date-format-string: "2011-03-24T20:30:47Z"

Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> (string->date date "~Y-m-dT~H:~M:SZ")
srfi/srfi-19.scm:1415:18: In procedure priv:string->date:
srfi/srfi-19.scm:1415:18: In procedure string->date: TIME-ERROR type bad-date-format-string: "~Y-m-dT~H:~M:SZ"

Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [2]> (string->date date "~Y-m-dT~H:~M:SZ")
srfi/srfi-19.scm:1415:18: In procedure priv:string->date:
srfi/srfi-19.scm:1415:18: In procedure string->date: TIME-ERROR type bad-date-format-string: "~Y-m-dT~H:~M:SZ"

Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [3]> (string->date "2000" "~Y")
srfi/srfi-19.scm:571:22: In procedure encode-julian-day-number:
srfi/srfi-19.scm:571:22: In procedure -: Wrong type: #f

thanks for any help

//guy



             reply	other threads:[~2017-02-14 12:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 12:27 Guy Baumann [this message]
2017-02-14 12:48 ` Help formatting a UTC Timestamp tomas
2017-02-14 13:11 ` Chris Vine
  -- strict thread matches above, loose matches on Subject: below --
2017-02-14  7:45 Help formatting a UTC TImestamp Guy Baumann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170214122716.GA2454@debian \
    --to=guy@gammarus.co.uk \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).