Min/Max date format in markup

8 posts, 0 answers
  1. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 22 Sep 2008 Link to this post

    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?
  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 25 Sep 2008 Link to this post

    hi


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


    Regards...
    <John:Peel />
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 25 Sep 2008 Link to this post

    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.
  5. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 25 Sep 2008 Link to this post

    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


  6. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 26 Sep 2008 Link to this post




    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 />

  7. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 26 Sep 2008 Link to this post

    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?
  8. Plamen Peshev
    Admin
    Plamen Peshev avatar
    886 posts

    Posted 29 Sep 2008 Link to this post

    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.
  9. Thomas
    Thomas avatar
    143 posts
    Member since:
    Feb 2007

    Posted 29 Sep 2008 Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017