Tuesday, September 20, 2016

Re: covert julian date to calander date

Thanks Erik,

i think that should do the trick.is there a way to covert the date column straight from the sql query or from the template?

cheers



On Tue, Sep 20, 2016 at 9:17 PM, Erik Cederstrand <erik+lists@cederstrand.dk> wrote:

> Den 20. sep. 2016 kl. 01.40 skrev sum abiut <suabiut@gmail.com>:
>
> Hi,
> how to you convert from Julian date to a Calender date. I am pulling data from an MSSQL and i what to convert the Julian date to calender date before displaying data on my template.

If I understand your question correctly, that should be easy. Just convert the Julian date to a Python date in your view:

   my_date = (datetime.datetime(my_year, 1, 1) + datetime.timedelta(days=julian_day)).date()


Erik

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/236EFE25-2F80-4247-9972-56DF60C662AA%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y7Shu8PoqKcP4HSxd3SsAxP%2BDs5aycgDVG4i-voRfWq7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment