The DateFormat property is present for both the UIProject entity as well as the Field property when a template supporting a DateFormat is selected for the Field.
The DateFormat set for the UIProject acts as a default for all Fields supporting DateFormats as long as the Field property is left with the default value of * (asterisk).
Typically, host applications are consistent in the presentation of dates, so setting the property in the UIProject should cover the "default case"...then, in those screens that are not consistent with the default, you can override the format on a field-by-field basis.
Any generated control, such as the FVDate custom control, provides the DateFormat property in Visual Studio, so any value set can be changed following code generation.
The DateFormat uses a format of recognized strings combined with special characters such as slashes, commas and so on.
Use the following table to compose your own DateFormat value, this is taken from the provided CalendarPopup.js file, which is a modified open-source file authored by Matt Kruse <matt@mattkruse.com>, http://www.mattkruse.com
The default value is MM/dd/yy which matches a date format such as 05/06/55 (May 6, 1955).
NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm!
Field |
Full Form |
Short Form |
Year |
yyyy (4 digits) |
yy (2 digits), y (2 or 4 digits |
Month |
MMM (name or abbr.) NNN (abbr.) |
MM (2 digits), M (1 or 2 digits) |
Day of Month |
dd (2 digits) |
d (1 or 2 digits) |
Day of Week |
EE (name) |
E (abbr) |
Hour (1-12) |
hh (2 digits) |
h (1 or 2 digits) |
Hour (0-23) |
HH (2 digits) |
H (1 or 2 digits) |
Hour (0-11) |
KK (2 digits) |
K (1 or 2 digits) |
Hour (1-24) |
kk (2 digits) |
k (1 or 2 digits) |
Minute |
mm (2 digits) |
m (1 or 2 digits) |
Second |
ss (2 digits) |
s (1 or 2 digits) |
AM/PM |
a |
Examples:
"MMM d, y" matches: January 01, 2000
Dec 1, 1900
Nov 20, 00
"M/d/yy" matches: 01/20/00
9/2/00
"MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"