Format of ExtJS DateField date Control

Source: Internet
Author: User

Address: http://hi.baidu.com/_ollie/item/39e67671c48bfd11d1dcb321

For Date format, see Date type in extjs api documentation.
Var md = new Ext. form. DateField ({
............
Format: 'Y-m-d H: I: s ',
............
});
Replace all the letters in 'Y-m-d H: I: s'. Of course, there is no problem with the addition or reduction. Pay attention to the case. You can get date formats of multiple styles.
Ext. Date Format description
D 01 to 31
D Mon to Sun
J 1 to 31
L Sunday to Saturday
N 1 (for Monday) through 7 (for Sunday)
S st, nd, rd or th. Works well with j
W 0 (for Sunday) to 6 (for Saturday)
Z 0 to 364 (365 in leap years)
W 01 to 53
F January to December
M 01 to 12
M Jan to Dec
N 1 to 12
T 28 to 31
L 1 if it is a leap year, 0 otherwise.
O Examples: 1998 or 2004
Y Examples: 1999 or 2003
Y Examples: 99 or 03
A am or pm
A am or PM
G 1 to 12
G 0 to 23
H 01 to 12
H 00 to 23
I 00 to 59
S 00 to 59
U 001 to 999
O Example: + 1030
P Example:-08:00
T Examples: EST, MDT, PDT...
Z-43200 to 50400
C 2007-04-17T15: 19: 21 + 08: 00
U 1193432466 or-2138434463
Additional: 20090416
The following lists all currently supported formats: Sample Data:
'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time )'
Format character output description
------------------------------------------------------------------------------
D. The number of days in January, double digits. The number of days is 0"
D Wed: the abbreviation of the current week, three letters
J. The number of days in March. Do not add "0"
L complete spelling of Wednesday in the current week
The suffix of the ordinal number of the day of the month in S th English, two characters (used with the format "j)
W 3 days in a week (1 ~ 7)
Z 9 the number of days in a year (0 ~ 365)
W 01 the number of weeks in a year, two digits (00 ~ 52)
F complete spelling of January's current month
M 01 current month, double-digit, inadequate fill "0"
The complete spelling of M Jan in the current month, with three letters
N 1 The current month. Do not add "0"
T 31 total days of the current month
L whether 0 is a leap year ("1" indicates a leap year, and "0" indicates a year)
Y 2007 the current number of years in four digits
Y 07 the current number of years expressed by two digits
A pm lowercase "am" and "pm"
Uppercase "am" and "PM" for A pm"
The current number of hours in the g 3 12-hour format"
The current hour in G 15 24-hour format. Do not fill in "0"
The current number of hours in the 12-hour format of H03"
The current number of hours in the H 15-24-hour format"
I 05 the number of minutes for filling "0"
S 01: the number of seconds in which the "0" is supplemented by the missing bits
O-0600 differences between hours and GMT
T cst current time zone set by the System
Z-21600 Time Zone offset in seconds (negative in the west and positive in the east) example: (Note that you must use the Escape Character "\" before a letter to output it as a letter rather than a format character ):var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
document.write(dt.format('Y-m-d')); //2007-01-10
document.write(dt.format('F j, Y, g:i a')); //January 10, 2007, 3:05 pm
document.write(dt.format('l, \\t\\he dS of F Y h:i:s A')); //Wednesday, the 10th of January 2007 03:05:01 PM
The following are some standard date/time templates that may be useful to you. They are not Date. but you can copy the following code and put it in Date. in any script referenced after js, it becomes a global variable and takes effect on all Date objects. You can add or delete this code segment as needed.Date.patterns = {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
};
Example:var dt = new Date();
document.write(dt.format(Date.patterns.ShortDate));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.