This is a migrated thread and some comments may be shown as answers.

Min/Max date format in markup

7 Answers 95 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 22 Sep 2008, 06:25 PM
How does Telerik parse the Min and Max date values when they are assigned in markup? More specifically, what exact format should I use so that there is no ambiguity in parsing the date format? Will something like the following always be interpreted properly:

MinDate="1900-01-01"

I have seen in other posts something like:
MinDate="1900/01/01"

Which is easier if any to eliminate ambiguity in the interpretation of the value if I happen to push my code to servers running on non-US cultures?

7 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 25 Sep 2008, 02:48 PM
hi


The MinDate property is set using a System.DateTime object.


Regards...
<John:Peel />
0
Thomas
Top achievements
Rank 1
answered on 25 Sep 2008, 03:00 PM
I don't think you understood the question. Specifically, in markup, what date format should I use such that it is universal? if in markup I write something like:
<telerik.RadDatePicker .... MinDate="1/5/2008"

How does the system know which culture to use to interpret that. Is it Jan 5 or May 1? Is it based on the culture setting of the server? If so, how I write my date such that it will be universally interpreted so that if my website is moved to five different servers with five different cultures they all interpret the date in the markup the same.
0
Thomas
Top achievements
Rank 1
answered on 25 Sep 2008, 03:19 PM
It is obvious that Telerik is using a DateTime object. That said, should I assume that Telerik is simply calling DateTime.Parse on the text using in markup? If that is the case, then I suppose something like the following is the safest:

2008-09-25T00:0:0


0
plamen
Top achievements
Rank 1
answered on 26 Sep 2008, 10:56 AM



You can use the following date format: MM/dd/yyyy

MM  - The numeric month. Single-digit months have a leading zero.
yyyy - The year in four digits, including the century.
dd     - The day of the month. Single-digit days have a leading zero.


Hope this helps...
<John:Peel />

0
Thomas
Top achievements
Rank 1
answered on 26 Sep 2008, 03:26 PM
So, if I enter MinDate="1/5/2000" in the markup, the server will know that means Jan 1, 2000 no matter where I install the site and no matter the culture of the server? I.e., if I install my site on a German server, it will still know that is Jan 1, 2000? What happens if a German developer on a German version of Windows creates the page? Am I to understand that the everyone in the world coding with Telerik controls must us US dates in the markup?
0
Missing User
answered on 29 Sep 2008, 08:23 AM
Hello Thomas,

The .NET Framework provides the type converter classes for almost all the basic data types. For example: the class ArrayConverter provides the type conversion support for the Array data type, the class BooleanConverter provides the support for the bool data type and the class DateTimeConverter provides the support for the DateTime data type. Some other common type converter classes include ByteConverter, CharConverter, DecimalConverter, DoubleConverter, Int16Converter, Int32Converter, EnumConverter, etc. All these type converter classes are derived from the base class TypeConverter.



You can review the following help article: DateTimeConverter Class


Regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Thomas
Top achievements
Rank 1
answered on 29 Sep 2008, 04:31 PM
I'm not sure why everyone is beating around the bush on this one.  The core question is, "What date format should I use in MARKUP so that it is universally recognized regardless of culture?"

That question leads to the question about how dates in markup are parsed. Clearly if it Telerik or Microsoft is using a DateConverter class, then the answer as I stated earlier is that DateTime.Parse is being called.

"The ConvertFrom method uses the Parse method of the DateTime class to convert from a string. "

If that is the case, then it gets a little hazier. It *should* be the case that yyyy-mm-dd is universally recognized however if you use the ISO format of yyyy-mm-ddT00:0:0 you are probably on safer ground. In addition, I have yet to see a straight answer on the delimiter. In other words, I've never seen a date written as yyyy/mm/dd. I "assume" that would be parsed like yyyy-mm-dd. Given that the ISO format uses dashes, I'm assuming that dashes are the standard.

Tags
Calendar
Asked by
Thomas
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Missing User
Share this question
or