[PEAK] DateTime, and datatype methods

R. David Murray rdmurray at bitdance.com
Tue Oct 26 19:09:11 EDT 2004


On Tue, 26 Oct 2004, Phillip J. Eby wrote:
> The easiest way to solve your problem would be to use peak.storage type
> converters.  Add this:
>
>     [Import on Demand]
>     datetime = "datetime"
>
>     [sqlite.sql_types]
>     TIMESTAMP = lambda descr,value:
> datetime.datetime.fromtimestamp(value.ticks())
>
> to your .ini file, and you'll get automatic conversion of TIMESTAMP columns
> to datetime.datetime.  You can define converters for any of 'DATE', 'INT',
> 'NUMBER', 'ROWID', 'STRING', 'TIME', and 'TIMESTAMP'.

Cool.  This is exactly what I needed to know.  Tomorrow I will
try implementing it.

By the way, I'm really thrilled at how easy implementing the business
rules is using peak and the domain model.  I'm sure I'm putting some
methods in weird places since this is my first such app, but even
so it is going swimingly.

--David



More information about the PEAK mailing list