Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Python Datetime to Javascript Datetime

#26

Hi,

python-spidermonkey looks very promising. One question: how can I convert a Python datetime Object to a Javascript Date Object? Is this done automatically or are there any recommended patterns for it?

Regards,

Franz

Reported by jspy · July 7th, 2009 @ 03:27 AM

State: new
Milestone: none
Assigned to: Paul J. Davis Paul J. Davis

Activity

  1. Paul J. Davis
    Paul J. Davis
    • Tag set to conversion, date

    jspy,

    There's no automatic conversion and I'm not certain on the best way to write one. I've heard of other people trying to do date conversions with limited success because the JavaScript date class is quite limited in what it can accept. IIRC, the idea was to format the Date in one of the ISO formats and have JavaScript's Date parse the string. Alot of the pain I remember was that JavaScript doesn't define a standard ISO format to use so different JS engines don't agree.

    If you find a reasonable method I'd definitely consider adding something built-in to do the conversion, but I don't have the time right now to investigate all of the intricacies of dates.

    Paul

    July 7th, 2009 @ 02:55 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.