jQuery UI Widgets › Forums › Editors › DateTimeInput › Full documentation of format strings ?
Tagged: column, columntype, culture, datetimeinput, format, format string, formatString, jqxdatetimeinput, localization, long, short, string
This topic contains 7 replies, has 3 voices, and was last updated by Dimitar 10 years, 4 months ago.
-
Author
-
Hi,
In the API documentation for “formatString” there is a list of supported formatting options (http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetimeinput-api.htm). From looking at some demo examples it seems like there are additional formatting options which In do not see in the API documentation, eg. “F” or “T”.
My question: is there a full documentation of all formatting string options to be found somewhere ?
Regars,
StephanHello Stephan,
Here are some more standard format strings for your reference:
// short date pattern d: “M/d/yyyy”,
// long date pattern D: “dddd, MMMM dd, yyyy”,
// short time pattern t: “h:mm tt”,
// long time pattern T: “h:mm:ss tt”,
// long date, short time pattern f: “dddd, MMMM dd, yyyy h:mm tt”,
// long date, long time pattern F: “dddd, MMMM dd, yyyy h:mm:ss tt”,
// month/day pattern M: “MMMM dd”,
// month/year pattern Y: “yyyy MMMM”,
// S is a sortable format that does not vary by culture S: “yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss”Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi,
I do have a further questionr regarding those formats. What I actually need is a short date/time format including seconds. In your list I found the formats “d” and “T”, but the following formatString: “d T” does not work.
My problem: if I construct my own detailed format specification, for instance along the lines of “M/d/yyyy h:mm:ss tt” I totally loose the culture specific date/time formatting that I expect and get from using “d” or “T”.
Thus my question: can I make something like “d T” work for a jqxDateTimeInput, so that I do not loose culture specific date/time formatting ? Or could you offer somthing like “short date long time” ?
SIDENOTE: both “f” and “F” are waaay to long mor my purpose of creating a small dialog input control. The long date format requires a huge amount of space.
Regards,
StephanHi Stephan,
Short date, long time can be build with this string: “M/d/yyyy h:mm:ss tt”.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Yes, that is the workaround I have already implemented, yet it has a major disadvantage: the format of date and time does NOT adapt automatically to the culture that has been set.
The reason (at least for me) for wanting to use “d” and “T” is that the formatting of the resulting date and time will be adjusted automatically to the current culture setting. If I do not use them I would have to code my own logic for culture adjusted date and time formatting. Thats why I would prefer the ability to specify “d T” (or somethign of similar effect) as a format.
Regards,
StephanHi Stephan,
The short Format Strings are defined in the culture-specific files – globalize.js, globalize.culture.fr-FR.js and so on. When you use a short format string, the format is retrieved from the culture-specific file. The long format strings are not defined in the culture-specific files and when you set a specific format string, the jqxDateTimeInput’s Date will be formatted with it.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Is there a way to format date type column to a string based on current culture format just as what custom format specifier “G” does in C#.
for e.g. if 6/12/2014 4:30:25 PM should display 12/6/2014 11:30:25 PM if user’s current culture is en-GBHello Yogesh Singh,
You can define a custom localization object which controls the date formatting, as done in the jqxGrid demo Localization.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.