[Zope] Validating a Date
Andreas Jung
Andreas Jung <lists@andreas-jung.com>
Thu, 27 Mar 2003 06:48:19 +0100
If you have a fixed date format, you can split into day,month and year
and pass these as dedicated arguments to the DateTime constructor.
See the DateTime API for details.
-aj
--On Donnerstag, 6. M=E4rz 2003 02:48 +0100 Oliver Bleutgen =
<myzope@gmx.net>=20
wrote:
> Peter Bengtsson wrote:
>> At 02:01 2003-02-28 -0600, Edward Muller wrote:
>>
>>> Does anyone know of a good module/product/hack that I can feed a date =
to
>>> and it will let me know if it's valid or not?
>>>
>>> It should check leap years ... end days of the month and the like...
>>
>>
>> try:
>> ok_date =3D context.ZopeTime('2003/13/13')
>> print "Yes, date OK"
>> except:
>> print "No, not OK"
>>
>> return printed
>
> Nope, ZopeTime(DateTime) is very (too) liberal in what it accepts for
> this purpose:
>
> context.ZopeTime('2002/30/3')
>
> returns "2002/03/30"
>
> cheers,
> oliver
>
>
>
>
>
> _______________________________________________
> 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 )
--=20
---------------------------------------------------------------------
- Andreas Jung http://www.andreas-jung.com -
- EMail: andreas at andreas-jung.com -
- "Life is too short to (re)write parsers" -
---------------------------------------------------------------------