• 2801 views
  • 0 comments
  • loading...

Checks that a field value contains a valid datetime in the specified format

This validator checks that a field value contains a valid datetime in the specified format. It is good practice to specify the format using the translation operator, in order to support different formats in different locales.
















requires = IS_DATETIME(format=T('%Y-%m-%d %H:%M:%S'),

error_message='must be YYYY-MM-DD HH:MM:SS!')

# The following symbols can be used for the format string (this shows the symbol and an example string):

%Y '1963'
%y '63'
%d '28'
%m '08'
%b 'Aug'
%b 'August'
%H '14'
%I '02'
%p 'PM'
%M '30'
%S '59'

Attributes / Arguments


requires = IS_DATETIME(format=T('%Y-%m-%d %H:%M:%S'),...)

Displays an error message.


Examples

loading...

Sources / Reference

" Web2py Book"


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)