Microsoft Ajax library cheat sheet (2): extensions of the Boolean and date types

Source: Internet
Author: User

 

The original cheat sheet (PDF version) is here to download: http://aspnetresources.com/downloads/ms_ajax_library_cheat_sheets1.zip

Original copyright statement:

Copyright (c) 2004-2006, Milan negovanhttp: // www. aspnetresources. comall rights reserved. redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met: * redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclawing. * redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclawing inthe documentation and/or other materials provided with thedistribution. * The name of the author may not be used to endorse or promote productsderived from this software without specific prior written permission. this software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limitedto, the implied warranties of merchantability and fitness for a participant purpose are disclaimed. in no event shall the copyright owner must be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence orotherwise) arising in any way out of the use of this software, even ifadvised of the possibility of such damage.

 

NOTE: If [s] is marked as a static method, it can be used without instantiating an object.

 

[S] Boolean. parse (value)

Parses the Boolean value represented by a string into the corresponding boolean type. The value parameter must be either "true" or "false". It is case-insensitive and can contain spaces.

 
VaRB = Boolean. parse ("True");

 

Date. Format (Format)

Format the string (Region settings are irrelevant ).

 
VaRD =NewDate ();
 
SYS. Debug. Trace (D. Format ("Dddd, DD mmmm yyyy hh: mm: SS"));

 

Date. localeformat (Format)

Format the string (related to region settings ). Use SYS. cultureinfo. currentculture to obtain the region attribute.

 
VaRD =NewDate ();
 
SYS. Debug. Trace (D. localeformat ("Dddd, DD mmmm yyyy hh: mm: SS"));

 

[S] date. parselocale (value, formats)

Parses the local time and date represented by the string into the corresponding date type. Use SYS. cultureinfo. currentculture to obtain the region attribute.

 
SYS. Debug. Trace (date. parselocale ("4/10/2001","Yyyy-mm-dd",
 
"Mm/DD/YYYY"));
 
// Date. parselocale will skip the first format here as invalid and use
// The second one. If it does not find an appropriate format,
 
// The function throws an exception.

 

[S] date. parseinvariant (value, formats)

Parses the region-independent date represented by the string into the corresponding date type.

 
SYS. Debug. Trace (date. parseinvariant ("4/10/2001","Yyyy-mm-dd",
 
"Mm/DD/YYYY"));
 
// Date. parseinvariant will skip the first format here as invalid and use
 
// The second one. If it does not find an appropriate format,
 
// The function throws an exception.

 

Supported formats

 

    1. D: Abbreviation date (e.g.: 02/17/2007 ):
    2. D: Date of completion (e. g: Saturday, 17 February 2007)
    3. T: Abbreviation time (e.g)
    4. T: Complete time (e.g.: 22:10:30)
    5. F: Full date (e.g.: Saturday, 17 February 2007 22:10:30)
    6. M (or m): Month and day (e.g.: February 17)
    7. S: Time and date that can be sorted (e.g.: 2007-02-17t22: 10: 30)
    8. Y (or Y): Year and month (e.g.: 2007 February)
Related Article

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.