In fact, I also have a headache with regular expressions. Baidu has some materials. To sum up, leave a backup here.
The question to consider is: the valid date, the number of days per month, and the leap year ....
1. valid date: the date and time
The problem is: in the tutorial, the default type of Date in the hibernate framework is the timestamp (datetime), so no additional configuration is required in the ing file, the format of year, month, day, and hour, minute, and second is required.
Plus reference: Using System.Text.RegularExpressions;Check if the string is a date format//2011-5-8 8:08:05public static string check (string s){if (Regex.IsMatch (s),"^ ((((1[6-9]| [2-9]\\d) \\d{2})-(0?[ 13578]|1[02])-(0?[ 1-9]| [12]\\d|3[01]) | (((
JS Gets the current date time and other operations var mydate = new Date (); Mydate.getyear (); Gets the current year (2-bit) mydate.getfullyear (); Get the complete year (4-bit, 1970-????) Mydate.getmonth (); Get the current
Applicable scenario -log time to Unix time sample log:
2017-03-21 00:00:00,291 INFO [dubboserverhandler-10.135.6.53:20885-thread-98] I.w.w.r.m.requirementmanager [ REQUIREMENTMANAGER.JAVA:860] Fetch no data from Oracle 2017-03-21 00:00:00,294
DataFormatString is a lot of asp.net controls have properties, such as the GridView, and so on, the following briefly describes this property.
The dataformatstring property syntax is as follows:
Dataformatstring= ' {0: format string} '
We know that {0} in DataFormatString
Represents the data itself, and the format string after the colon represents the format in which you want the data to appear, and you can specify the number of digits to display for a decimal after the specified format sym
123,456,789.0000" Total: {0: c} "12345.6789 total: $12345.68 the following table lists common date formats: format description output format D simplified Date Format mm/DD/yyyy d detailed Date Format dddd, Mmmm DD, yyyy F complete format (long date + short time) dddd, Mmmm DD, yyy
e){System.Globalization.DateTimeFormatInfo Mydtfi = new System.Globalization.CultureInfo ("en-us", false). DateTimeFormat;China with ZH-CNDateTime myDT =system.datetime.now;Response.Write (Mydt.tostring ("F", Mydtfi));/**//**//**//*This code produces the following output.FORMAT en-US EXAMPLECHAR VALUE of associated property, IF anyD 1/3/2002 m/d/yyyy (ShortDatePattern)D Thursday, January, 2002 dddd, MMMM D
12345.6789"{0: G7}" 123456789 1.234568e8"{0: n}" 12345.6789 12,345.68"{0: N4}" 123456789 123,456,789.0000"Total: {0: c}" 12345.6789 total: $12345.68
The commonly used date formats are shown in the following table:
Format description output formatD. Simplified Date Format: mm/DD/YYYYD detailed Date Format: dddd, Mmmm DD, yyyyF full format (long date + short time) dddd, Mmmm DD,
This example shows how to format DateTime using String.Format method. All formatting can is done also using datetime.tostring method.Custom DateTime FormattingThere is following custom format specifiers (year), (month), (Day y M d ), h (Hour), H (Hour 24), c5/> (minute), s (second), ( f second fraction), ( F second fraction, trailing zeroes is trimmed), t (p.m. or a.m.) and z (time zone).Following examples demonstrate how is the format specifiers rewritten to the output.//Create date Time 2008-0
Set the DataFormatString of BoundField. Generally, the following types of DataFormatString = "{0: C}" currencies are available. The format of the currencies depends on the settings of the Culture in the current Thread. DataFormatString = "{0: e} "scientific notation DataFormatString =" {0: P} "percentage DataFormatString =" {0: F ?} "The digits after the decimal point DataFormatString =" {0: d} "M/d/yyyy such as 10/30/2008 DataFormatString =" {0: f} "
Data Binding-dataformatstring
Set the dataformatstring of boundfield. There are usually the following types:Dataformatstring = "{0: c}" currency. The format of the currency depends on the settings of the culture in the current thread.Dataformatstring = "{0: e}" scientific notationDataformatstring = "{0: p}" percentageDataformatstring = "{0: F ?} "Number of decimal placesDataformatstring = "{0: d}" m/D/YYYY, for example, 10/30/2008Dataformatstring = "{
DataFormatString of data bindingSet the dataformatstring of BoundField, usually have the following severalDataformatstring= "{0:c}" currency, the format of the currency depends on the culture setting in the current threadDataformatstring= "{0:e}" scientific notationDataformatstring= "{0:p}" percentageDataformatstring= "{0:f}" several decimal placesDataformatstring= "{0:d}" m/d/yyyy as 10/30/2008Dataformatstring= "{0:f}" Long date, short time. Dddd,
ShortDatePattern (short date mode)
D
Dddd,mmmm dd,yyyy
Longdatepattern (long date mode)
F
Dddd,mmmm dd,yyyy hh:mm
Full date and times (long date and short) (all date and time mode)
F
Dddd,mmmm dd,
"); April 2008 24 15:56 48 seconds System.DateTime.Now.ToString ("yyyy mm month dd hh when mm min ss seconds"); Tuesday, April System.DateTime.Now.ToString ("dddd, MMMM dd yyyy"); II, April ' System.DateTime.Now.ToString ("ddd, MMM d \" ' \ "yy"); Tuesday, April System.DateTime.Now.ToString ("dddd, MMMM
DataFormatString is a property of many Asp. Net controls, such as the GridView. The following briefly introduces this property.The syntax of the DataFormatString attribute is as follows: DataFormatString = "{0: Format String }"We know {0} In DataFormatString}Represents the data itself, and the format string after the colon represents the format that we want the data to display; in addition, after the specified format symbol, you can specify the number of digits to be displayed in decimal places.
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.