Simplest solution for formatting local time in iso 8601 includingtime zone.

Discussion in 'Python' started by rowland@river2sea.org, Sep 10, 2008.

  1. Guest

    What's the simplest solution for formatting the output of local time
    in iso 8601 including the time zone information?

    Example:

    "2008-07-25T14:28:43.934-04:00"


    Thanks,
    Rowland
    , Sep 10, 2008
    #1
    1. Advertising

  2. Chris Rebert Guest

    On Tue, Sep 9, 2008 at 9:32 PM, <> wrote:
    > What's the simplest solution for formatting the output of local time
    > in iso 8601 including the time zone information?
    >
    > Example:
    >
    > "2008-07-25T14:28:43.934-04:00"


    You want the isoformat() method of datetime objects.
    See http://docs.python.org/lib/datetime-datetime.html for details.

    You'll need to pass 'T' as the separator to isoformat() and pass in a
    tzinfo object when constructing the datetime object.

    Regards,
    Chris

    >
    >
    > Thanks,
    > Rowland
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >




    --
    Follow the path of the Iguana...
    http://rebertia.com
    Chris Rebert, Sep 10, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    2
    Views:
    8,479
    Kathy Burke
    Nov 18, 2003
  2. =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=

    prevent a postback when moving web parts from zone to zone.

    =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    576
    =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=
    Feb 8, 2006
  3. Imbaud Pierre

    iso 8601, quality criteria

    Imbaud Pierre, Feb 8, 2007, in forum: Python
    Replies:
    1
    Views:
    267
    Imbaud Pierre
    Feb 8, 2007
  4. Kasper Tidemann
    Replies:
    1
    Views:
    339
    Rick DeNatale
    Apr 29, 2010
  5. nick

    ISO 8601 date format

    nick, Apr 21, 2010, in forum: Javascript
    Replies:
    10
    Views:
    661
    Dr J R Stockton
    Apr 24, 2010
Loading...

Share This Page