Date functionality

4 messages Options
Embed this post
Permalink
monks () Date functionality
Reply Threaded More More options
Print post
Permalink

hi
Is there any functionality in Python DateTime Module that can find
lets say whether, 'Date2' exists between 'Date1' and 'Date3' ?

Actually, i'm trying to create an archive that will display contents
between Start & End Date given by user, according to 'Publishing Date'
(its a custom Archetype field added)

--

Regards,
Mayank Mathur





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users

Regards,
Mayank
Hendrik Bunke () Re: Date functionality
Reply Threaded More More options
Print post
Permalink
--On Wed, 4 Nov 2009 13:25, Mayank Mathur wrote:

>
> hi
> Is there any functionality in Python DateTime Module that can find
> lets say whether, 'Date2' exists between 'Date1' and 'Date3' ?
>
> Actually, i'm trying to create an archive that will display contents
> between Start & End Date given by user, according to 'Publishing Date'
> (its a custom Archetype field added)

I would ask the catalog using AdvancedQuery's Between, e.g.
Between('yourPublishedFieldIndex', Date1, Date3).

regards
hendrik

--
Dr. Hendrik Bunke
http://hbxt.org

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Bastien Gauthier () Re: Date functionality
Reply Threaded More More options
Print post
Permalink
The current catalog already do this :

portal_catalog(date = {'query': (datefrom, dateto), 'range':minmax}, ...)

But if you want to be sure that a date exists between 2 dates, just do

Mydate = DateTime(mydate) --> this will raise if the format is not ok

If datefrom<Mydate and dateto>Mydate:
    ...

Have a nice day,

BASTIEN Gauthier
Service Informatique - Administration Communale de Sambreville
071/260.247
http://www.sambreville.be
 

>-----Message d'origine-----
>De : Hendrik Bunke [mailto:[hidden email]]
>Envoyé : mercredi 4 novembre 2009 12:10
>À : plone-users
>Objet : Re: [Plone-Users] Date functionality
>
>--On Wed, 4 Nov 2009 13:25, Mayank Mathur wrote:
>
>>
>> hi
>> Is there any functionality in Python DateTime Module that can find
>> lets say whether, 'Date2' exists between 'Date1' and 'Date3' ?
>>
>> Actually, i'm trying to create an archive that will display contents
>> between Start & End Date given by user, according to
>'Publishing Date'
>> (its a custom Archetype field added)
>
>I would ask the catalog using AdvancedQuery's Between, e.g.
>Between('yourPublishedFieldIndex', Date1, Date3).
>
>regards
>hendrik
>
>--
>Dr. Hendrik Bunke
>http://hbxt.org
>
>---------------------------------------------------------------
>---------------
>Let Crystal Reports handle the reporting - Free Crystal
>Reports 2008 30-Day trial. Simplify your report design,
>integration and deployment - and focus on what you do best,
>core application coding. Discover what's new with Crystal
>Reports now.  http://p.sf.net/sfu/bobj-july 
>_______________________________________________
>Plone-Users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/plone-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
ajung () Re: Date functionality
Reply Threaded More More options
Print post
Permalink
In reply to this post by monks
Standard comparison operators are applicable to DateTime instance (as one might think of).

-aj

monks wrote:
hi
Is there any functionality in Python DateTime Module that can find
lets say whether, 'Date2' exists between 'Date1' and 'Date3' ?

Actually, i'm trying to create an archive that will display contents
between Start & End Date given by user, according to 'Publishing Date'
(its a custom Archetype field added)

--

Regards,
Mayank Mathur





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Plone-Users mailing list
Plone-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users