ComponentOne True DBGrid Pro 8
Specifying a date mask for a column

The EditMask property also supports a built-in DateMask option for formatting date fields. When the DateMask option is selected, the following input mask template will be used for editing:

Example Title
Copy Code
mm/dd/yyyy

where

mm                               Month placeholder (01-12)

dd                                 Date placeholder (01-31)

yyyy                             Year placeholder

The user can enter either 1, 2, 3, or 4 digits in the year portion of the date, and the grid will save the year as entered by the user. If the user enters 1 or 2 digits for the year portion, the grid will make no interpretation for the year; that is, the grid will not assume whether it is the century 1900 or 2000, but will store the 1-digit or 2-digit year as entered. Before the date is updated to the database, you can interpret the year yourself in code, or let the underlying database system handle the interpretation and storage.

Note that if you select the DateMask option for the EditMask property, the date separators are part of the date format; they are not considered as literal characters and will always be cached by the grid. This is because most databases and formatters require the separator characters to be present in order to interpret the date correctly.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback