osdir.com


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

jilian to Gregorian date conversion error


Hi Dennnis,
Thank you for your email. My issue is i what to be able to display the rage
of date base on the start and end date that was selected but i don't know
how to do that.
when i did a for look from my template for example.

{%for a in result_proxy%}
  <td>{{a.date_applied}}</td>

{%endfor%}

i was able to display the range of dates but its is julian date but i don't
want the dates to be in julian dates. I want the dates to be in a gregorian
date where by the end users can understand it. Which is why i was trying to
convert that from my view.py before passing the the parameter to the
template.

appreciate any assistances.

cheers,

On Sun, Apr 29, 2018 at 2:39 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com>
wrote:

> On Thu, 26 Apr 2018 15:43:43 +1100, sum abiut <suabiut at gmail.com>
> declaimed
> the following:
>
> >ok so i have fixed that using the for loop
> >
> >result_proxy=connection.execute(stmt).fetchall()
> >            for a in result_proxy:
> >                test=datetime.date.fromordinal(int(a.date_applied))
> >
> >
> >Now if i want to pass a range of date to date_applied above. How to i do
> that?
> >
> >I know in sql i did did it like this
> >rate.columns.date_applied.between(covert,convert1)
> >
> >where convert and convert1 are the range of date
>
>         You are now getting into basic logic and algorithm design -- which
> is
> not something specific to Python.
>
>         Since I don't have access to the database schema, nor most of the
> surrounding code, I can only brute force a solution... It would probably be
> better to modify the SQL "stmt" to only return the desired entries but...
>
>
>         ...
>                 for a in r_p:
>                         ada = int(a.date_applied)
>                         if convert <= ada <= convert1:
>                                 ...
>
>
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>