The school calendar has the following features: 1. display the week of the current semester; 2. display the event of today; 3. display the date of the event. Click the date to display the event of the current day. :
Controller code:
Code
The Code is as follows:
Public ActionResult CalendarDisplay (){BL. DateEventBL de = new BL. DateEventBL ();// Obtain the date of the current day and convert it to the date format using javascript.DateTimeFormatInfo myDTFI = new CultureInfo ("en-US", false).
Supports cross-origin code, time is converted to a fixed format, local time
In the Application_BeginRequest method of Global:
Thread. CurrentThread. CurrentCulture = new CultureInfo ("zh-CN ");Thread. CurrentThread. CurrentUICulture = new CultureInfo ("zh-CN ");
Add the following code in the Initialize () method of WebApiModule:
// Cross-origin code GlobalConfiguration. configuration. enableCors (new enablecorsattricors ("*", "*", "*"); // Json time format Clock. provider = ClockProviders. loca
@Controller declare the action component @Service declare Service components @Service ("Mymovielister") @Repository declare DAO components @Component refer to components when they are not well categorized. @ Requestmapping ("/menu") Request mapping @Resource for injection, (provided by Java EE) by default assembly by name, @Resource (name= "Beanname") @Autowired for Injection, (Srping provided) by type, @Transactional (Rollbackfor={exception.class}) transaction Management @Resp
workaround is to change the datetime type to a string type itself, and then serialize it. If you do not want to modify the code, you can implement the following scenario.Json.NET provides a isodatetimeconverter date conversion class that can be jsnconverter to achieve the appropriate date conversion [Jsonconverter (typeof (Isodatetimeconverter))] Public DateTime Birthday {get; set;}But the Isodatetimeconverter date format is not what we want, we can inherit the class to implement its own
system will be formatted into the ISO date standard, but the actual use of most of the use of the process may be yyyy-mm-dd or YYYY-MM-DD HH:mm:ss Two formats of the date, The workaround is to change the datetime type to a string type itself, and then serialize it. If you do not want to modify the code, you can implement the following scenario.Json.NET provides a isodatetimeconverter date conversion class that can be jsnconverter to achieve the appropriate date conversion [Jsonconverter (typ
Previously written with reflection, conversion, and later felt a big loophole, recently found someone wrote this help class, so save it downpublic class Jsonhelper{DataRow transfer JSONpublic static object Datarowtojson (DataRow row){dictionaryforeach (DataColumn column in row. Table.columns){Datalist.add (column. ColumnName, Row[column]);}Return Objecttojson (dataList);}////DataRow to Object, generic method ////////// public static T datarowtoobject { return jsontoobject} ////DataRow to Object,
Using system; using system. net; using system. collections. generic; using system. io; using system. XML; namespace ciceng {public class cicengjson {public object xmltojson () {var xml = file. readalltext (@ "D: \ cnblogs. XML "); // This XML is the backup file xmldocument Doc = new xmldocument (); Doc. loadxml (XML); // get the content var channelxml = Doc under the RSS node. selectsinglenode ("RSS "). innerxml; // further refine the XML format. The content is only the content Doc under the RSS
Get valid working days between any two dates (excluding Saturday) get valid working days between any two dates (excluding Saturday) # region obtains valid working days between any two dates (excluding Saturday)// Call// Datetime date1 = convert. todatetime ("2005-10-20 ");// Datetime date2 = convert. todatetime ("2005-11-01 ");// Int days = getdays (date1, date2 );Private int getdays (system. datetime date1, system. datetime date2){String M = datediff (enumdatecompare. Day, date1, date2). tostri
:
Controller code:
Code
Copy code The Code is as follows: public actionresult calendardisplay ()
{
BL. dateeventbl de = new BL. dateeventbl ();
// Obtain the date of the current day and convert it to the date format using JavaScript.
Datetimeformatinfo mydtfi = new cultureinfo ("En-us", false). datetimeformat;
String utctime = datetime. Now. tostring ("Mmm DD, yyyy hh: mm: SS", mydtfi );
Viewdata ["currentday"] = utctime;
// Obtain the date of t
used in the previous project, and the new version of mybatis 3.0.1 has changed a lot, if you upgrade it, the previous program should be greatly adjusted.
Here we will share with you a previously modified ibator program and make many improvements:
Removed all useless "generated by Apache ibatis ibator" prompts in object classes and XML ing files.
Added the javaheadercomment and xmlheadercomment attributes to generate file headers (including copyrighted author information) in object classes and
common/config/main. the 'components' => ['formatter '=> ['dateformat' => 'yyyy-MM-dd ', 'datetimeformat' => 'yyyy-MM-dd HH: mm: ss', 'decimalseparator' => ',', 'thousandseparator' => '', 'currencycode' => 'cny ',],],
Here we use a fast Writing Method: "attribute: format: label" (attribute: format: label). For details, click the api documentation here. So we can do this: (if the top part is defined, method 2 can be directly 'format' => 'date' to displ
. ToString () or float. ToString () method for invariant or English culture.
[C #]
DataView. rowFilter = "Year = 2008" // integer value dataView. rowFilter = "Price = 1199.9" // float value dataView. rowFilter = String. format (CultureInfo. invariantCulture. numberFormat, "Price = {0}", 1199.9f );Date values are enclosed within sharp characters #. The date format is the same as is the result of DateTime. ToString () method for invariant or English culture.
[C #]
DataView. rowFilter = "Date = #12
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.