Il 10/02/14 12:06, Alex ha scritto: > Is it possible to update a datetime column with milliseconds precision? > > e.g. I have a field > Field('invoice_date', 'datetime') > > and I'm updating the field: > now = datetime.datetime.now() > db(db.invoice.id == 743).update(invoice_date=now) > > the currren time contains milliseconds: > 11:58:35.696000 > > In the executed sql statement the milliseconds are not used: > UPDATE invoice SET invoice_date='2014-02-10 11:58:35' WHERE > (invoice.id = 743); > > Is there a way to change this and also set milliseconds? Have you tried using IS_DATETIME validator specifying a datetime format like "%Y-%m-%d %H:%M:%S.%f" ?
http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior M. > > Alex > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google > Groups "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.