[Zope] Saving a Julian Date solved

McDonnell, Larry lmcdonnell@protonenergy.com
Tue, 20 May 2003 13:03:01 -0400


Hi,

Thanks Troy, I needed to use Python (int_to_string) to convert the integer
value to string and this is much cleaner.

-----Original Message-----
From: Troy Farrell [mailto:troy@entheossoft.com]
Sent: Tuesday, May 20, 2003 12:53 PM
To: McDonnell, Larry
Cc: 'Zope@Zope. Org' (E-mail)
Subject: Re: [Zope] Saving a Julian Date solved


I know nothing about Julian dates, but I can see that this would be much 
cleaner as a python script:

from DateTime import DateTime

now = DateTime()
j_year = str(now.yy()[1])
j_day = str(now.dayOfYear())
j_date = j_year + j_day

return j_date

Name the script julianDate and call it with

<dtml-var julianDate>

or

<span tal:replace="here/julianDate">3140</span>

Hope that helps.
Troy

McDonnell, Larry wrote:
> Hi,
> 
> After some testing and some luck I got it to work:
> 
> <dtml-call "int_to_string(_.DateTime().yy()[1],REQUEST)">
> <dtml-call "REQUEST.set('j_year', y)">
> <dtml-call "int_to_string(_.DateTime().dayOfYear() ,REQUEST)">
> <dtml-call "REQUEST.set('j_day', y)">
> <dtml-call "REQUEST.set('j_date', j_year+ j_day)">
> 
> <dtml-var j_date>
> 
> -----Original Message-----
> From: McDonnell, Larry 
> Sent: Tuesday, May 20, 2003 11:06 AM
> To: 'Zope@Zope. Org' (E-mail)
> Subject: [Zope] Saving a Julian Date
> 
> 
> 
> Hi,
> 
> I have been googling around and I am sort of found what I am looking for
> below:
> 
> In DTML:
> <dtml-var expr="_.DateTime().yy()[1]"><dtml-var
> expr="_.DateTime().dayOfYear()">
> 
> I see this is for display but how do I save the julian date so I can
> populate a datebase? Thanks.
> 
> 
> 
> Larry McDonnell
> 
> Proton Energy Systems
> 10 Technology Drive
> Wallingford, CT 06492
> (203) 678-2181
> Email:lmcdonnell@protonenergy.com
> www.protonenergy.com
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )