Date and time - Date
TreeGrid documentation
Date type shows date and / or time in selected format.
It supports direct editing or selecting the date(s) from popup calendar.
Format
<C> <cell> string
Type
["Text"] Type = "Date"
To define Date type, set column or cell attribute Type to "
Date"
<cell> type
value
The date values in input XML can be set as string in these formats,
date: yyyy-M-d, M-d, M/d/yyyy, M/d, dd.MM.yyyy, dd.MM
time: HH:mm, HH:mm:ss, hh.mm, hh.mm.ss, including am/pm, AM/PM, a.m./p.m., A.M./P.M.
If set only time, it cannot be separated by dot.
The date values in input XML can be also set as number of milliseconds from 1/1/1970 00:00:00
The date values uploaded to server are by default in format "M/d/yyyy HH:mm:ss", if some part of date is 0, it is omitted.
If some date in input XML is set as number of milliseconds, all uploaded dates are also in number of milliseconds. See <Cfg
DateStrings/> attribute.
The date values in API are always integers as number of milliseconds from 1/1/1970 00:00:00
new 6.0 <C> <cell> bool
CanEmpty
[1]
If the cell date value differ between 1/1/1970 00:00:00 and "".
It has sense especially for time only values.
If set to 0, the empty input value is always converted to 1/1/1970 00:00:00, internally to 0. So the cell never contains (empty) string value.
new 6.0 <C> <cell> string
EmptyValue
[""]
The string displayed when the date value is entered as empty string.
The cell can contain empty value only if
CanEmpty is 1.
It is shown only for display, not for edit.
It is
not escaped, it can contain HTML code.
new 6.3 upd 6.7 <Cfg><C><cell> string
DefaultDate
Default date (and time) shown in calendar for empty dates.
(new 6.7) Used also when editing date / time in cell, the missing in the input are got from the DefaultDate.
For example input: "12/12" and DefaultDate: "1/1/2000 21:30" will return "12/12/2000 21:30"
upd 15.0 <C> <I> <cell> string
Format
Specifies date and / or time string format - how the date and / or time will be displayed.
This format string uses almost the same formatting as Microsoft .NET System.DateTime.
ToString (string format) function.
Empty format
If the
Format is not set or is empty (default), the default US English format is used "M/d/yyyy HH:mm:ss".
If some part of the date is 0, it is omitted, some examples: "5/9/2000 12:43:56", "12:00", "6/5/2000".
If set
BaseSeparators, it uses the localized date and time separators.
Standard format (two letters)
(New 14.0.10) Localized in all languages. Separated date and time, to use date with time use Assembled format like "sd*tm".
This format loads user format from file
Text.xml or localized TextXX.xml, tag <
Format>.
sd | Short partial date | US:"M/d", GB: "d/M", DE:"d.M" |
sy | Short full date | US:"M/d/yyyy", GB:"d/M/yyyy", DE:"d.M.yyyy" |
sw | Short full date with week day | US:"ddd M/d/yyyy", GB:"ddd d/M/yyyy", DE:"ddd d.M.yyyy" |
sm | Short month and year | US:"M/yyyy", GB:"M/yyyy", DE:"M/yyyy" |
sn | Short week number | US:"\wddddddd", GB:"\wddddddd", DE:"\Wddddddd" |
ld | Long partial date | US:"MMMM d", GB:"dddddd MMMM", DE:"dddddd MMMM" |
ly | Long full date | US:"MMMM d, yyyy", GB:"dddddd MMMM yyyy", DE:"dddddd MMMM yyyy" |
lw | Long full date with week day | US:"dddd, MMMM d, yyyy", GB:"dddd, dddddd MMMM yyyy", DE:"dddd dddddd MMMM yyyy" |
lwa | Long full date with abbreviated week day | US:"ddd, MMMM d, yyyy", GB:"ddd, dddddd MMMM yyyy", DE:"ddd dddddd MMMM yyyy" |
lm | Long month and year | US:"MMMMMMM yyyy", GB:"MMMMMMM yyyy", DE:"MMMMMMM yyyy" |
ln | Long week number | US:"'week' ddddddd", GB:"'week' ddddddd", DE:"'Woche' ddddddd" |
ad | Abbreviated partial date | US:"MMM d", GB:"dddddd MMM", DE:"dddddd MMM" |
ay | Abbreviated full date | US:"MMM d, yyyy", GB:"dddddd MMM yyyy", DE:"dddddd MMM yyyy" |
aw | Abbreviated full date with week day | US:"ddd, MMM d, yyyy", GB:"ddd, dddddd MMM yyyy", DE:"ddd dddddd MMM yyyy" |
awl | Abbreviated full date with long week day | US:"dddd, MMM d, yyyy", GB:"dddd, dddddd MMM yyyy", DE:"dddd dddddd MMM yyyy" |
am | Abbreviated month and year | US:"MMMMMMM yyyy", GB:"MMMMMMM yyyy", DE:"MMMMMMM yyyy" |
an | Abbreviated week number | US:"'week' ddddddd", GB:"'week' ddddddd", DE:"'Woche' ddddddd" |
th | Standalone time, hours only | US:"h tt", GB:"HH", DE:"HH" |
tm | Standalone time, hours and minutes | US:"h:mm tt", GB:"HH:mm", DE:"HH:mm" |
ts | Standalone time, hours, minutes and seconds | US:"h:mm:ss tt", GB:"HH:mm:ss", DE:"HH:mm:ss" |
tf | Standalone time, hours, minutes, seconds and ms | US:"HH:mm:ss.fff", GB:"HH:mm:ss.fff", DE:"HH:mm:ss.fff" |
sth | Time for short date, hours only | US:" h tt", GB:" HH", DE:" HH" |
stm | Time for short date, hours and minutes | US:" h:mm tt", GB:" HH:mm", DE:" HH:mm" |
sts | Time for short date, hours, minutes and seconds | US:" h:mm:ss tt", GB:" HH:mm:ss", DE:" HH:mm:ss" |
stf | Time for short date, hours, minutes, seconds and ms | US:" HH:mm:ss.fff", GB:" HH:mm:ss.fff", DE:" HH:mm:ss.fff" |
lth | Time for long date, hours only | US:", h tt", GB:", HH", DE:", HH" |
ltm | Time for long date, hours and minutes | US:", h:mm tt", GB:", HH:mm", DE:", HH:mm" |
lts | Time for long date, hours, minutes and seconds | US:", h:mm:ss tt", GB:", HH:mm:ss", DE:", HH:mm:ss" |
ltf | Time for long date, hours, minutes, seconds and ms | US:", HH:mm:ss.fff", GB:", HH:mm:ss.fff", DE:", HH:mm:ss.fff" |
yq | Year and quarter | US:"MMMMM yyyy", GB:"MMMMM yyyy", DE:"MMMMM yyyy" |
yq | Year and half | US:"MMMMMM yyyy", GB:"MMMMMM yyyy", DE:"MMMMMM yyyy" |
Auto format (one letter)
Auto format is
one letter format. This format loads user format from file
Text.xml or localized TextXX.xml, tag <
Format>.
It is automatically chosen for
Auto type according to the content.
d | Short date | ("M/d/yyyy") |
h | Short date + short time | ("M/d/yyyy H:mm") renamed 13.0, from "g" |
H | Short date + long time | ("M/d/yyyy H:mm:ss") renamed 13.0, from "G" |
j | Short date + short time with am/pm | ("M/d/yyyy h:mm tt") new 13.0 |
J | Short date + long time with am/pm | ("M/d/yyyy h:mm:ss tt") new 13.0 |
m | Day and short month | ("M/d") changed 13.0 |
y | Short month and year | ("M/yyyy") changed 13.0 |
t | Short time | ("H:mm") |
T | Long time | ("H:mm:ss") |
i | Short time with am/pm | ("h:mm tt") new 13.0 |
I | Long time with am/pm | ("h:mm:ss tt") new 13.0 |
D | Long date | ("d. MMMM yyyy") |
l | Long date + short time | ("d. MMMM yyyy H:mm") renamed 13.0, from "f" |
L | Long date + long time | ("d. MMMM yyyy H:mm:ss") renamed 13.0, from "F" |
k | Long date + short time with am/pm | ("d. MMMM yyyy h:mm tt") new 13.0 |
K | Long date + long time with am/pm | ("d. MMMM yyyy h:mm:ss tt") new 13.0 |
M | Day and long month | ("d. MMMM") |
Y | Long month and year | ("MMMMMMM yyyy"). For month name uses the attribute LongMonthNames2 (from file Text.xml, tag <Format>). LongMonthNames2 could contain noun's first case if the language supports it. |
Special format (one letter)
Special format is used for display only. It is
one letter format. This format loads user format from file
Text.xml or localized TextXX.xml, tag <
Format>.
g | Short date + short time | ("M/d/yyyy H:mm") Deprecated 13.0, collides with number format |
G | Short date + long time | ("M/d/yyyy H:mm:ss") Deprecated 13.0, collides with number format |
f | Long date + short time | ("d. MMMM yyyy H:mm") Deprecated 13.0, collides with number format |
F | Long date + long time | ("d. MMMM yyyy H:mm:ss") Deprecated 13.0, collides with number format |
s | Sortable date time | ("yyyy-MM-ddTHH:mm:ss") |
u | Universal sortable date time | ("yyyy-MM-dd HH:mm:ssZ") |
U | Universal date time | for example: 13. January 2004 17:12:34. This date time is converted to GMT ! |
r, R | RFC1123 | ("ddd MMM d HH:mm:ss UTCzzzzz yyyy"), for example: Tue, 13 Jan 2004 18:12:34 GMT Deprecated 13.0, collides with number format |
a | Long date with week | ("dddd, dddddd MMMM yyyy") |
Assembled format
Since 14.0 if the format string contains asterisk (*), it loads the user defined formats from <Lang><Format ... /></Lang> tag.
For example: <Lang><Format d1='d/M/yy' d2='d/M' d3='yyyy' t1=' HH:mm'/><Lang>,
Format="*d1" is converted to "d.M.yy",
Format="d1*t1" is converted to "d.M.yy HH:mm",
Format="d2*/*d3*+++*t1" is converted to "d/M/yyyy+++ HH:mm".
The assembled format can refer any predefined formats (Standard, Auto, Special) and any predefined custom format.
The assembled format can refer another assembled format, these references should contain asterisk on both sides.
User format
User format can contain any characters but only few have special meaning and other are written into output without any change.
: | Place for time separator, defined in file Text.xml, tag <Format>, attribute TimeSeparator. (colon by default). |
/ | Place for time separator, defined in file Text.xml, tag <Format>, attribute DateSeparator. (slash by default). |
d | Month days 1 - 31 |
dd | Month days 01 - 31 |
ddd | Weekdays Sun - Sat |
dddd | Weekdays Sunday - Saturday |
ddddd | Weekdays S - S |
dddddd | Month days 1st - 31st |
ddddddd | Year weeks 1 - 52 |
dddddddd | Year weeks 01 - 52 (new 9.0) |
D | not used |
DD | The rest of days in week, in count of weeks from 1/1/1970 (it is not weekday!) (new 6.1) |
DDD | Year day 0 - 365 (new 6.1) |
DDDD | Count of days from 1/1/1970, for duration in days (new 6.1). Since 13.0 accepted also as [d] |
DDDDD | Count of weeks from 1/1/1970, for duration in weeks, see DD (new 6.1) |
DDDDDD | Tenths of month days: empty,1,2,3 (new 6.3) |
DDDDDDD | Month days: 1-9,0-9,0-9,0-1 (new 6.3) |
M | Month 1 - 12 |
MM | Month 01 - 12 |
MMM | Month Jan - Dec |
MMMM | January - December |
MMMMM | Year quarters, I, II, III, IV |
MMMMMM | Year halves, I, II |
MMMMMMM | January - December, used LongMonthNames2 for languages with inflection |
y | Year 0 - 99 |
yy | Year 00 - 99 |
yyy | Count of years from 1/1/1970, for duration in years (new 6.1). Since 13.0 accepted also as [y] |
yyyy | Year 0000 - 9999 |
yyyyy | Year of week 0000 - 9999, use with week numbers (ddddddd). It differs from yyyy only in few last days in December. (new 15.0) |
h | Hours 1 - 12 |
hh | Hours 01 - 12 |
hhh | Count of hours from 1/1/1970 00:00:00, for duration in hours (new 6.1). Since 13.0 accepted also as [h] |
hhhh | Tenths of hours empty or 1 (new 6.3) |
hhhhh | Hours 1-9, 0-2 (new 6.3) |
H | Hours 0 - 23 |
HH | Hours 00 - 23 |
HHH | not used |
HHHH | Tenths of hours empty or 1 (new 6.3) |
HHHHH | Hours 0-9, 0-9, 0-3 (new 6.3) |
m | Minutes 0 - 59 |
mm | Minutes 00 - 59 |
mmm | Count of minutes from 1/1/1970 00:00:00, for duration in minutes (new 6.1). Since 13.0 accepted also as [m] |
mmmm | Tenths of minutes 0 - 5 (new 6.3) |
mmmmm | Minutes 0 - 9 (new 6.3) |
s | Seconds 0 - 59 |
ss | Seconds 00 - 59 |
sss | Count of seconds from 1/1/1970 00:00:00, for duration in seconds (new 6.1). Since 13.0 accepted also as [s] |
ssss | Tenths of seconds 0 - 5 (new 6.3) |
sssss | Seconds 0 - 9 (new 6.3) |
f | Hundreds of milliseconds, 0 - 9 (new 6.3) |
ff | Tenths of milliseconds 00 - 99 (new 6.3) |
fff | Milliseconds - 000 - 999 (new 6.3) |
ffff | Tenths of milliseconds 0 - 9 (new 6.3) |
fffff | Milliseconds - 0 - 9 (new 6.3) |
t | First letter of AM/PM designator, by default A or P as the first character of AMDesignator / PMDesignator. Since 13.0 it can be set also by "a/p" or "A/P". |
tt | AM/PM designator, by default AM or PM. Since 13.0 it can be set also by "am/pm" or "AM/PM".
The designator is defined in file Text.xml, tag <Format>, attributes AMDesignator and PMDesignator.
|
z | Timezone hours -12, +0, +13 |
zz | Timezone hours -12, +00, +13 |
zzz | Timezone hours and minutes, -12:00, +0:00, +13:00 |
\ | Escape character, the next character is placed to output without any changes. Use to place format characters as d,M,y,... It needs to be doubled '\\' |
'xxx' or "xxx" | Characters in quotes or double quotes are placed to output without any changes. Use to place format characters as d,M,y,... |
% | Place before format when use one character user format like 'd' (=> '%d') to not be taken as standard format. |
; | (new 13.0) Separates the format for text as prefix@suffix where @ displays the text or if @ is missing, it displays only the text after the ";".
Since 13.3 it separates the formats with conditions. |
[color] | (new 13.0) Colors the whole text in given CSS color. |
[condition] |
(new 13.3) Uses given part (parts are separated by semicolon) only if the value fulfills the condition.
Condition can be simple as: [=date], [<>date], [<date], [<=date], [>date], [>=date].
Or the condition can be complex JavaScript formula. The formula can use predefined variables d (day), M (month), y (year), w (week day, 0 = Sunday), h (hours), m (minutes), s (seconds), t (milliseconds).
yh (hijri year), Mh (hijri month), dh (hijri day).
For compatibility it can use also "=" and "<>" for comparing.
For example: Format="[y>2010&&y<2015][blue]d.M.yyyy;[y=2018][red]d.M;d.M.yyyy"
|
For example:
Format='dddd, MMMM yyyy hh:mm:ss tt' => "Sunday, February 2004 13:24:00"
Format='"date:" MM/dd/yyyy", time:" HH:mm" => "date: 10/03/2001, time: 12:34"
If you want add
HTML tags before and after value, use rather cell attributes
HtmlPrefix and
HtmlPostfix instead of
Format.
If you really need to place
HTML tags into output (for example to use HTML tags for one part of date only), set
<Cfg NoFormatEscape='1'>. The HTML tags can be set in
Format only,
not in
EditFormat.
Since 15.0 it is read also from row.
chg 13.3 upd 15.0 <C> <I> <cell> string
EditFormat
Format string for editing the date and / or time.
In this format is displayed the Date cell when edited.
It is also used for parsing entered date string if it is ambiguous, e.g. "18/04" can be "dd/MM", "MM/dd" or even "yy/MM".
Empty format
Since 13.3 if it is not set, it uses
Format value.
If it is
empty, it accepts all formats like input XML:
date: yyyy-M-d, M-d, M/d/yyyy, M/d, dd.MM.yyyy, dd.MM
time: HH:mm, HH:mm:ss, hh.mm, hh.mm.ss, including am/pm, AM/PM, a.m./p.m., A.M./P.M.
If set only time, it cannot be separated by dot.
Standard or user format
Its structure is the same as
Format, but not all formats are possible for input, only number inputs are supported.
Since 13.3 if set
StrictDates 3. bit (&4) (default setting), months can be entered also by their name or shortcut. In this case the separators are not required. The month names can be localized in
InputMonthNames.
The format should contains only these parts of custom format: d, dd, DDDD, M, MM, MMM, MMMM, y, yy, yyyy, h, hh, hhh, H, HH, m, mm, mmm, s, ss, sss, t, tt.
Since 13.0 all the other unsupported parts of the custom format are removed or converted to supported parts.
Since 13.3 the unsupported standard formats can be converted to supported formats according to
EditFormats.
The user can use more separators set by
InputDateSeparators,
InputTimeSeparators and
InputDateTimeSeparators.
The am / pm can be localized in
InputAMPMDesignators.
If set
StrictDates 4. bit (&8) (default setting) the user can also enter the date / time without separators, only as number, in formats like HHmm, HHmmss, MMddyy, MMddyyyy, in the order set in the EditFormat.
Since 15.0 it is read also from row.
new 16.2 <Cfg> string
EditDateTimeFormat
Specifies format for editing for all cells without
EditFormat of "Date" or "Auto" type containing date with time.
new 16.2 <Cfg> string
EditDateFormat
Specifies format for editing for all cells without
EditFormat of "Date" or "Auto" type containing date without time.
new 16.2 <Cfg> string
EditTimeFormat
Specifies format for editing for all cells without
EditFormat of "Date" or "Auto" type containing only time.
Usual settings in spreadsheet are EditDateTimeFormat="H" EditDateFormat="d" EditTimeFormat="T".
chg 15.0 <C> <I> <cell> string
ExportFormat
TreeGrid date time format to be used instead of the cell
Format for export to Excel.
Its format is the same as
Format, it is converted to Excel number format.
From 12.1 to 14.1 it was not used for old xls export except for ExportType="Dates", it used XlsFormat instead.
Since 15.0 it is used for all exports, including xls and it is also read from row.
new 12.1 chg 15.0 <C> <I> <cell> string
XlsFormat
Excel date time format to be used instead of the cell
Format and
ExportFormat for export to Excel.
It is exact MS Excel format string passed directly to xlsx format or to xls CSS attribute
mso-number-format.
Since 15.0 it is used also for xlsx and it is also read from row.
It is not used to export to csv.
chg 6.0 <Cfg> bool
NoFormatEscape
[1]
If set to "", it means
0 for text and
1 for number and date.
If set to
0, the Format is escaped, so the characters & and < are displayed as they are.
If set to
1, you can use HTML tags in columns
Format string, in prefix and postfix for text and anywhere for numbers.
new 13.0 <Cfg> bool
ExcelDates
[0]
0 - all dates in grid are integer numbers as count of milliseconds since 1/1/1970.
1 - all dates in grid are floating numbers as count of days since 1/1/1900.
Cannot be used with Gantt chart
It affects everything, input data and output data if dates are numbers and all dates for API.
Setting to 1 sets also all dates to GMT by <Format GMT='1'/>.
Due internal implementation the setting is shared among all grids on page!
chg 6.0 <Cfg> type
DateStrings
[0/1]
If set to
0, Date values are uploaded as numbers (milliseconds from 1/1/1970), see also
GMT attribute.
If set to
1, Date values are uploaded as strings in English format (M/d/yyyy HH:mm:ss).
If set to
2, Date values are uploaded as strings in JAVA format (yyyy-MM-dd HH:mm:ss).
If set to
string, it specifies the full date format for upload.
By default it is set to
0, if some date in input XML is set as number of milliseconds, otherwise is set to
1.
chg 6.0 <Format> bool
GMT
[1]
If set to
1, all
number dates are in GMT / UTC and are not affected by a user time zone, all users will see the same times.
If set to
0, all
number dates are in the local time of user time zone, so they are shown different for different time zones.
The number dates are the input / output dates set as count of milliseconds from 1/1/1970 00:00:00.
The dates are internally stored always as the numbers, so if you access the cell values directly, you get / set always the count of milliseconds.
This setting is global for all grids on page!
Setting GMT to 0 is not recommended in Gantt chart, because of shifts due summer / winter time.
new 6.2 <C> <cell> bool
GMT
Cell GMT modification for display and edit.
If this attribute has different value than <Format
GMT> value, it shows the cell date in local or GMT timezone.
It affect only display and editing date string,
not the value itself, so for upload, API, calculations, sort, filter, search and Gantt are still used the original values.
<Format> int
Hirji
[0] RTL
Because of backward compatibility the attribute name is Hirji instead of Hijri
If grid uses and shows Persian Hijri / Jalali dates and calendar instead of standard Gregorian dates, bit array.
1. bit (&1) - 1 - All dates are displayed and entered in Hijri.
2. bit (&2) - 2 - All dates in XML are in Hijri.
new 13.0 chg 13.3 <Format> int
StrictDates
[15]
If and how restricts entering incorrect dates, bit array.
1. bit (&
1) - If set, restricts entering incorrect dates. If not set, accepts also dates like 14/30/2000 and converts it to 2/30/2001.
2. bit (&
2) -
new 13.3 If set, the entered string must contain only date, not any prefix or suffix string.
3. bit (&
4) -
new 13.3 If set, permits entering month by its name or shortcut.
4. bit (&
8) -
new 13.3 If set, permits entering date or time as a number without separators (e.g. "020718" as 2/7/2018).
5. bit (&
16 -
new 13.3 If set, permits entering elapsed time (hours>23 or minutes/seconds > 59), but the time cannot be set without separators.
It affects only cells without
EditFormat. With EditFormat the incorrect dates are always restricted and depend on the edit format.
Since 13.3 default value changed from 1 to 7.
new 13.0 <Format> int
DateFormatLowercase
[1]
If set, the months can be set also by 'm' and 24hour hours also by 'h' in the
Format string.
The 'm' as month is identified if the format contains d or D or y and does not contain h or H or M.
The 'h' as 24hour hour is identified if the format does not contain t or tt.
If set to
2, it also converts the whole Format to lower case before used.
global func. string
DateToString
(Date date, string format)
Converts date to string according to format string like in function ToString() in C#.NET.
date can be string or number, will be converted to date by standard Date(string).
If format is missing, uses English format "mm/dd/yyyy hh:mm:ss", for today uses "hh:mm:ss", for 00:00:00 uses "mm/dd/yyyy", seconds are omitted if are 0.
global func. Date
StringToDate
(string str, string format)
Converts string to date according to format string as in function ToString() in C#.NET.
If format is missing, converts str as in standard format for date "d.m.y", "d.m", "m/d/y", "m/d", "y-m-d","m-d" and time "hh:mm:ss", "hh:mm" and for date and time combines these formats separated by any other character.
Calendar component
<C> <cell> string
Button
["Date"]
For
editable Date type is the button set to "Date" by default, except is set
<Cfg AutoCalendar='1'/>.
It shows right side button to display popup Calendar dialog on click to choose the date from.
To hide the calendar button set Button="", it is useful especially for time only values.
<Cfg> bool
AutoCalendar
If set to
1, Calendar dialog for Date cells is displayed automatically when user starts editing. In this case the calendar reflects changes in the input and vice versa.
If set to
1, the Button type Date is
not displayed for Date type by default. To display it, there must be explicitly set by
Button='Date'.
new 6.0 <C> <cell> bool
AutoCalendar
If set to
1, Calendar dialog for Date cells is displayed automatically when user starts editing. In this case the calendar reflects changes in the input and vice versa.
If set to
1, the Button type Date is still displayed for Date type by default. To hide it, there must be explicitly set by
Button=''.
The difference to
<Cfg AutoCalendar/> is only in the default visibility of the Date button.
chg 6.0 upd 6.7 <C> <cell> int
CalendarButtons
[0/7]
Which calendar buttons will be visible. By default for empty value are all buttons displayed for
Range and no button for standard date cells. Bit array.
1. bit (&1) - Today button, 2. bit (&2) - Clear button, 3. bit (&4) - OK button. = 0 no button visible, = 7 all buttons visible.
Since 6.7 there can be 4.bit (&8) for Yesterday button.
new 6.2 <C> <cell> string
Calendar
Full settings of the calendar in JSON format. See the
documentation.
new 9.0 <C> <cell> string
ActualDate
Actual date highlighted in calendar. If not used, used today according to the client time.
<Actions>
ShowCalendar ...FAO
Attached to events OnClickSideDate, OnEnter, OnCtrlDown
Displays the Calendar dialog for selecting date for the actual or focused cell.
API event bool
OnCanEditDate
(TGrid grid, TRow row, string col, Date date)
Called when displaying Calendar dialog for every date in the calendar to permit only some dates to be selected by user.
new 10.0 API event string
OnGetCalendarDate
(TGrid grid, TRow row, string col, Date date, string text, string[ ] classes, bool range)
Called when displaying Calendar dialog for every date in the calendar to let modify the displayed date text and / or class.
date is the Date object for given day.
text is the text that will be displayed for the day.
classes is an array of four CSS classes that will be used for the day: [normal, hover, selected, selected+hover]. The event handler can modify theses four strings to use different CSS classes.
range is true if the calendar will permit selecting more dates or date ranges. If it is false, the
classes use only first two strings.
Return the text of date or
text.
new 11.0 API method TCalendar
ShowCalendar
(TRow row, string col, TCalendar Calendar, TPosition Pos = null, function Func = null, object Date = null, bool always = false)
Shows custom calendar for given cell.
Closes any actually shown dialog in grid. If there is already dialog shown for this cell and
not set
always, it closes the dialog and returns null.
Calendar contains special settings for the calendar.
Func is function (
TMenuItem I) called after click to the menu. The
I has at least
I.Name as the item name. It replaces
menu.
OnSave.
Date is initial date to show in calendar.
For more information about the parameters see global function
ShowCalendar.
To manually close the calendar you can call API method
CloseDialog or calendar.Close().
Shows custom calendar on given position. For more information see the
ShowCalendar.
Dates dialog for date ranges and repeating
new 7.0 <C> <cell> string
Button
["Dates"]
It shows right side button to display popup
Dates dialog on click to choose the date ranges.
This dialog is used for
Text type in special format
"Repeat1#Date1a~Date1b#Value1;Repeat2#Date2a~Date2b#Value2;..."
This format is used for
GanttExclude,
GanttBackground and Gantt resource
Availability. And can be used also for any custom reason.
The default meaning of the format is repeat date range set by
DateXa~DateXb every
RepeatX time unit and optionally assign given
ValueX to these ranges.
It is possible to set only
Value as for all dates. It is also possible to omit
Value to not use it. And it is possible to omit
Repeat to not repeat the date range.
The Dates dialog shows new popup grid with columns defined by next attributes.
The popup grid has set its id to
DatesDialog, you can control it in API events as usual, e.g.
Grids.OnLoaded = function(G){ if(G.id=='DatesDialog') { ... } }
The grid internal column names are
Repeat,
Start,
StartTime,
End,
EndTime,
Value.
Due internal implementation the Dates dialog is available only in Extended API!
new 7.0 <C> <cell> type
DatesRepeatXXX
Sets attribute XXX of column
Repeat in the Dates grid.
Attribute Type of the Repeat column is Text by default.
For example set:
DatesRepeatType="Enum" DatesRepeatEnum="||Weekly|Daily" DatesRepeatEnumKeys="||w|d"
To hide the column set
DatesRepeatVisible='0'
new 7.0 <C> <cell> type
DatesStartXXX
Sets attribute XXX of column
Start in the Dates grid.
Attribute Type of the Start column is Date by default.
For example set:
DatesStartFormat="dddd, dddddd MMMM" DatesStartEditFormat="M/d/yyyy"
new 7.0 <C> <cell> type
DatesStartTimeXXX
Sets attribute XXX of column
StartTime in the Dates grid.
Attribute Type of the StartTime column is Date by default.
This column is automatically hidden, if
Start column is not of Type Date.
new 7.0 <C> <cell> type
DatesEndXXX
Sets attribute XXX of column
End in the Dates grid.
Attribute Type of the End column is Date by default.
For example set:
DatesEndFormat="dddd, dddddd MMMM" DatesEndEditFormat="M/d/yyyy"
new 7.0 <C> <cell> type
DatesEndTimeXXX
Sets attribute XXX of column
EndTime in the Dates grid.
Attribute Type of the EndTime column is Date by default.
This column is automatically hidden, if
End column is not of Type Date.
new 7.0 <C> <cell> type
DatesValueXXX
Sets attribute XXX of column
Value in the Dates grid.
Attribute Type of the Value column is Float by default.
For example set
DatesValueType="Enum" DatesValueEnum="|-5|-4|-3|-2|-1|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15"
To hide the column set
DatesValueVisible='0'
new 7.0 <C> <cell> string
DatesXXXCaption
Caption for the XXX column, where XXX can be Repeat, Start, End or Value.
new 7.0 <C> <cell> bool
DatesEndLast
[1]
If set to 1 and end date has not set time, it is shown as day before.
For example 1/1/2000 is shown as 12/31/1999, but 1/1/2000 1:00 is shown as 1/1/2000 1:00.
new 8.0 <C> <cell> int
DatesHeight
[ ]
Maximal height of the dialog in pixels. Default setting is grid main tag height.
For higher grids the popup grid shows vertical scrollbar.
new 11.0 <C> <cell> bool
DatesEmptyDate
[0]
0 - The start date and end date must be set both or both empty.
1 - The start date and end can be independently set or empty.
new 10.0 API event void
OnDatesClose
(TGrid grid, TGrid dates, bool saved)
Called when the Dates dialog is closed.
grid is the source grid that opened the Dates dialog.
dates is the grid showing dates dialog.
saved is
false if no changes were saved (clicked to cancel or clicked to ok without any change in the dialog),
true is when something changed by the dialog.
new 7.0 <Actions>
ShowDates ...FAO
Attached to event OnClickSideDates
Displays the Dates dialog for selecting date ranges for the actual or focused cell.
Localization
The default date format and setting are specified in
Text.xml, in <
Lang><
Format /></
Lang> tag.
The default settings is for
English language, changing the
Format tag attributes you can easily localize it to another language.
new 12.0 <Format> bool
BaseSeparators
[0]
Controls Int, Float and Date types conversions to string without explicit format string set.
If set to
1, it always uses standard U.S. English decimal, date and time separators and also date order M/d/yyyy.
If set to
0, it uses actual
DecimalSeparator,
DateSeparator and
TimeSeparator
and date format is chosed according to the date separator as "M/d/yyyy" or "d.M.yyyy" or "yyyy-M-d".
Prior to 12.0 the default value and behavior was 1, since 12.0 was changed to 0!
<Format> string[ ]
ShortDayNames
The week day short names, starting Sunday, used for the format "ddd"
Default is "Sun,Mon,Tue,Wed,Thu,Fri,Sat"
<Format> string[ ]
LongDayNames
The week day full names, starting Sunday, used for the format "dddd"
Default is "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
<Format> string[ ]
Day1CharNames
The week day one character names, starting Sunday, used for the format "ddddd"
Default is "S,M,T,W,T,F,S"
<Format> string[ ]
Day2CharNames
The week day calendar names, starting Sunday, used in calendar.
Default is "Su,Mo,Tu,We,Th,Fr,Sa"
<Format> string[ ]
DayNumbers
The month day numbers 1 - 31, used for the format "dddddd"
Default is "1st,2nd,3rd,4th,5th,6th,7th,8th,9th,10th,11th,12th,13th,14th,15th,16th,17th,18th,19th,20th,21st,22nd,23rd,24th,25th,26th,27th,28th,29th,30th,31st"
<Format> string[ ]
ShortMonthNames
The month short names, starting January, used for the format "MMM"
Default is "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"
<Format> string[ ]
LongMonthNames
The month full names, starting January, used for the format "MMMM" and also in calendar
These names are expected for month name
with day, like 20th January 2000.
Default is "January,February,March,April,May,June,July,August,September,October,November,December"
<Format> string[ ]
LongMonthNames2
The month full names, starting January, used for the format "MMMMMMM"
These names are expected for month name
without day, like January 2000.
Default is "January,February,March,April,May,June,July,August,September,October,November,December"
new 13.3 <Format> string[ ]
InputMonthNames
[...]
The month names or shortcuts used for entering the month name, starting January, used for StrictDates &4. Case insensitive.
It can contain 12, 24, 36, 48, etc. month names, defined in 12 item sets like "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,Ja,Fe,Ma,Ap,Ma,Jn,Jl,Au,Se,Oc,No,De".
Default is empty to use ShortMonthNames, LongMonthNames and LongMonthNames2 for entering month names.
<Format> string[ ]
Quarters
The year quarter names or numbers, used for the format "MMMMM"
Default is "I,II,III,IV"
<Format> string[ ]
Halves
The year half names or numbers, used for the format "MMMMMM"
Default is "I,II"
new 14.0 <Format> string
CalendarMonth
["MMMMMMM yyyy"]
Format to display month and year in calendar header.
<Format> string
DateSeparator
[/]
The string displayed in place of '/' in the format string. It is intended to separate date parts.
new 6.0 <Format> char[ ]
InputDateSeparators
[/.-]
The characters accepted as date separator while editing
<Format> string
TimeSeparator
[:]
The string displayed in place of ':'' in the format string. It is intended to separate time parts.
new 6.0 <Format> char[ ]
InputTimeSeparators
[:]
The characters accepted as time separator while editing
new 13.3 <Format> char[ ]
InputDateTimeSeparators
[...]
The characters accepted as separator between date and time while editing. Case insensitive.
Default is any character except digits and InputTimeSeparators and InputDateSeparators, but nothing added to accepted characters for editing Date.
<Format> string
AMDesignator
[AM]
The string displayed for dates before noon. It is used only for display.
<Format> string
PMDesignator
[PM]
The string displayed for dates after noon. It is used only for display.
new 13.3 <Format> string[]
InputAMPMDesignators
[...]
AM and PM designator names used accepted for editing. Case insensitive.
It can contain more names defined like "am,pm,a,p,a.m,p.m".
Default is AMDesignator,PMDesignator and also their first character.
<Format> int
FirstWeekDay
[0]
The starting day of the week, the 0 is Sunday, 1 Monday, ....
It is used by Calendar dialog.
new 7.0 chg 11.0 <Format> int
FirstWeekYearDay
[0]
The first day in week (always from Sunday) to be the week marked as the first week in year.
Set it to
0 for U.S. week numbering and to
3 for ISO/European week numbering.
Set
FirstWeekDay accordingly, for standard behavior you should use FirstWeekDay=0 for U.S. numbering and 1 for ISO numbering.
Since 11.0 the default value has been changed to
0 for U.S. week numbering to be synchronized with FirstWeekDay.
<Format> string
NaD
[NaN]
String displayed for incorrect date - Not a Date.
new 13.3 <Format> string[]
EditFormats
[""]
Conversion for standard one letter date formats for editing.
It converts the first item to the second item, third item to the fourth item and so on.
Default value in versions 13.0 - 13.2 was "M,m,D,d,l,h,L,H,f,h,F,H,Y,y,U,H,r,H,R,H,a,d,k,j,K,J" to convert "M" => "m", "D" => "d", "f" => "h", "F" => "H", "Y" => "y", "U" => "H", "r" => "H", "R" => "H", "a" => "d"
Since 13.3 the default value is empty to not convert any format, but rather automatically remove the unsupported parts for editing.
new 7.1 <Format> int
HirjiYear
[0] RTL
Because of backward compatibility the attribute name is HirjiYear instead of HijriYear
Used when converting input hijri dates with year less than 100.
By default it is added 1300 to the year.
If defined HirjiYear, the years less or equal to this number are increased by 1400 instead of 1300.
new 12.0 <Format> int
Digits
[]
First character separated array of 10 digits strings to replace the standard digits 0 - 10.
Useful to display Arabic digits instead of standard digits by such definition:
<Lang><Format Digits="|٠|١|٢|٣|٤|٥|٦|٧|٨|٩"/></Lang>
It replaces all digits in all cells, regardless of the cell type!
new 12.0 <C> <cell> int
Digits
[]
Digits to replace for this cell or column.
Used only if some <Format Digits> are defined.
Set it to empty string to not use the <Format
Digits>
new 13.3 API method void
UpdateLangFormat
( )
Updates internal language settings. Call it after a change of the Lang.Format attributes.