<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="assemblypath;works\assm;"/> </assemblyBinding> </runtime> </configuration>
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="assemblypath;works\assm;"/> </assemblyBinding> </runtime> </configuration>
// Update AppDomain's Base Directory string root_path = "c:\\temp\\"; AppDomain.CurrentDomain.SetData("APPBASE", root_path); // Retrieve AppDomain's Base Directory AppDomain.CurrentDomain.BaseDirectory.ToString() // Update Environment's Current Directory Environment.CurrentDirectory = root_path;
string strConfigPath = "your_config_file_path.config"; ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = strConfigPath; DefaultConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
<html> <head> <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <script type="text/javascript"> $(function(){ // add row button $('.append_button').click(function(){ var row = $('<div class="lister">'+new Date()+' <input type="button" class="row_button" value="click me!" /></div>'); row.appendTo('.container'); }); // delegate for append button $('.container').delegate('.lister input:button', 'click', function(){ alert('delegate ok!'); }); // delegate for append button (falied, because .lister was not found on delegate action) $('.container .lister').delegate('input:button', 'click', function(){ alert('delegate, again!'); }); }); </script> </head> <body> <div class="container"> <input type="button" class="append_button" value="Add" /> </div> </body> </html>
Style Code | Style | Format | Example |
---|---|---|---|
0 or 100 | Default. Equivalent to not specifying a style code. | mon dd yyyy hh:mmAM | Sep 8 2007 9:00PM |
1 | USA date. | mm/dd/yy | 09/08/07 |
2 | ANSI date. | yy.mm.dd | 07.09.08 |
3 | UK / French date. | dd/mm/yy | 08/09/07 |
4 | German date. | dd.mm.yy | 08.09.07 |
5 | Italian date. | dd-mm-yy | 08-09-07 |
6 | Abbreviated month. | dd mmm yy | 08 Sep 07 |
7 | Abbreviated month. | mmm dd, yy | Sep 08, 07 |
8 or 108 | 24 hour time. | HH:mm:ss | 21:00:00 |
9 or 109 | Default formatting with seconds and milliseconds appended. | mon dd yyyy hh:mm:ss:fffAM | Sep 8 2007 9:00:00:000PM |
10 | USA date with hyphen separators. | mm-dd-yy | 09-08-07 |
11 | Japanese date. | yy/mm/dd | 07/09/08 |
12 | ISO date. | yymmdd | 070908 |
13 or 113 | European default with seconds and milliseconds. | dd mon yyyy HH:mm:ss:fff | 08 Sep 2007 21:00:00:000 |
14 or 114 | 24 hour time with milliseconds. | HH:mm:ss:fff | 21:00:00:000 |
20 or 120 | ODBC canonical date and time. | yyyy-mm-dd HH:mm:ss | 2007-09-08 21:00:00 |
21 or 121 | ODBC canonical date and time with milliseconds. | yyyy-mm-dd HH:mm:ss.fff | 2007-09-08 21:00:00.000 |
101 | USA date with century. | mm/dd/yyyy | 09/08/2007 |
102 | ANSI date with century. | yyyy.mm.dd | 2007/09/08 |
103 | UK / French date with century. | dd/mm/yyyy | 08/09/2007 |
104 | German date with century. | dd.mm.yyyy | 08.09.2007 |
105 | Italian date with century. | dd-mm-yyyy | 08-09-2007 |
106 | Abbreviated month with century. | dd mmm yyyy | 08 Sep 2007 |
107 | Abbreviated month with century. | mmm dd, yyyy | Sep 08, 2007 |
110 | USA date with hyphen separators and century. | mm-dd-yyyy | 09-08-2007 |
111 | Japanese date with century. | yyyy/mm/dd | 2007/09/08 |
112 | ISO date with century. | yymmdd | 20070908 |
126 | ISO8601, for use in XML. | yyy-mm-ddThh:mm:ss | 2007-09-08T21:00:00 |
DateTime from = new DateTime(2011, 1, 7); DateTime to = DateTime.Now; TimeSpan ts = to - from; Console.WriteLine("start time : {0:yyyy/MM/dd HH:mm:ss}", from); Console.WriteLine("end time : {0:yyyy/MM/dd HH:mm:ss}", to); Console.WriteLine("time diff : {0}", ts); Console.WriteLine("month diff : {0}", (to.Month - from.Month) + 12 * (to.Year - from.Year)); Console.WriteLine("day diff : {0}", ts.TotalDays); Console.WriteLine("hour difff : {0}", ts.TotalHours); Console.WriteLine("minutes diff : {0}", ts.TotalMinutes); Console.WriteLine("second diff : {0}", ts.TotalSeconds);