{"id":718,"date":"2019-10-31T10:30:16","date_gmt":"2019-10-31T01:30:16","guid":{"rendered":"http:\/\/csharp.ihavenomoney.co.kr\/?p=718"},"modified":"2019-10-31T10:30:37","modified_gmt":"2019-10-31T01:30:37","slug":"string-format0s-0fff","status":"publish","type":"post","link":"https:\/\/csharp.ihavenomoney.co.kr\/?p=718","title":{"rendered":"string.Format(&#8220;{0:s}.{0:fff}"},"content":{"rendered":"\n<pre class=\"lang:c# decode:true \" >DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);\r\n\r\nString.Format(\"{0:y yy yyy yyyy}\", dt);  \/\/ \"8 08 008 2008\"   year\r\nString.Format(\"{0:M MM MMM MMMM}\", dt);  \/\/ \"3 03 Mar March\"  month\r\nString.Format(\"{0:d dd ddd dddd}\", dt);  \/\/ \"9 09 Sun Sunday\" day\r\nString.Format(\"{0:h hh H HH}\",     dt);  \/\/ \"4 04 16 16\"      hour 12\/24\r\nString.Format(\"{0:m mm}\",          dt);  \/\/ \"5 05\"            minute\r\nString.Format(\"{0:s ss}\",          dt);  \/\/ \"7 07\"            second\r\nString.Format(\"{0:f ff fff ffff}\", dt);  \/\/ \"1 12 123 1230\"   sec.fraction\r\nString.Format(\"{0:F FF FFF FFFF}\", dt);  \/\/ \"1 12 123 123\"    without zeroes\r\nString.Format(\"{0:t tt}\",          dt);  \/\/ \"P PM\"            A.M. or P.M.\r\nString.Format(\"{0:z zz zzz}\",      dt);  \/\/ \"-6 -06 -06:00\"   time zone<\/pre>\n<pre class=\"lang:c# decode:true \" >String.Format(\"{0:d\/M\/yyyy HH:mm:ss}\", dt); \/\/ \"9\/3\/2008 16:05:07\" - english (en-US)\r\nString.Format(\"{0:d\/M\/yyyy HH:mm:ss}\", dt); \/\/ \"9.3.2008 16:05:07\" - german (de-DE)\r\n<\/pre>\n<pre class=\"lang:c# decode:true \" >tring.Format(\"{0:M\/d\/yyyy}\", dt);            \/\/ \"3\/9\/2008\"\r\nString.Format(\"{0:MM\/dd\/yyyy}\", dt);          \/\/ \"03\/09\/2008\"\r\n\r\n\/\/ day\/month names\r\nString.Format(\"{0:ddd, MMM d, yyyy}\", dt);    \/\/ \"Sun, Mar 9, 2008\"\r\nString.Format(\"{0:dddd, MMMM d, yyyy}\", dt);  \/\/ \"Sunday, March 9, 2008\"\r\n\r\n\/\/ two\/four digit year\r\nString.Format(\"{0:MM\/dd\/yy}\", dt);            \/\/ \"03\/09\/08\"\r\nString.Format(\"{0:MM\/dd\/yyyy}\", dt);          \/\/ \"03\/09\/2008\"<\/pre>\n<p>Standard DateTime Formatting<br \/>\nIn DateTimeForma\u00adtInfo there are defined standard patterns for the current culture. For example property ShortTimePattern is string that contains value h:mm tt for en-US culture and value HH:mm for de-DE culture.<\/p>\n<p>Following table shows patterns defined in DateTimeForma\u00adtInfo and their values for en-US culture. First column contains format specifiers for the String.Format method.<\/p>\n<p>Specifier\tDateTimeFormatInfo property\tPattern value (for en-US culture)<br \/>\nt\tShortTimePattern\th:mm tt<br \/>\nd\tShortDatePattern\tM\/d\/yyyy<br \/>\nT\tLongTimePattern\th:mm:ss tt<br \/>\nD\tLongDatePattern\tdddd, MMMM dd, yyyy<br \/>\nf\t(combination of D and t)\tdddd, MMMM dd, yyyy h:mm tt<br \/>\nF\tFullDateTimePattern\tdddd, MMMM dd, yyyy h:mm:ss tt<br \/>\ng\t(combination of d and t)\tM\/d\/yyyy h:mm tt<br \/>\nG\t(combination of d and T)\tM\/d\/yyyy h:mm:ss tt<br \/>\nm, M\tMonthDayPattern\tMMMM dd<br \/>\ny, Y\tYearMonthPattern\tMMMM, yyyy<br \/>\nr, R\tRFC1123Pattern\tddd, dd MMM yyyy HH&#8217;:&#8217;mm&#8217;:&#8217;ss &#8216;GMT&#8217; (*)<br \/>\ns\tSortableDateTi\u00admePattern\tyyyy&#8217;-&#8216;MM&#8217;-&#8216;dd&#8217;T&#8217;HH&#8217;:&#8217;mm&#8217;:&#8217;ss (*)<br \/>\nu\tUniversalSorta\u00adbleDateTimePat\u00adtern\tyyyy&#8217;-&#8216;MM&#8217;-&#8216;dd HH&#8217;:&#8217;mm&#8217;:&#8217;ss&#8217;Z&#8217; (*)<br \/>\n \t \t(*) = culture independent<\/p>\n<pre class=\"lang:c# decode:true \" >String.Format(\"{0:t}\", dt);  \/\/ \"4:05 PM\"                         ShortTime\r\nString.Format(\"{0:d}\", dt);  \/\/ \"3\/9\/2008\"                        ShortDate\r\nString.Format(\"{0:T}\", dt);  \/\/ \"4:05:07 PM\"                      LongTime\r\nString.Format(\"{0:D}\", dt);  \/\/ \"Sunday, March 09, 2008\"          LongDate\r\nString.Format(\"{0:f}\", dt);  \/\/ \"Sunday, March 09, 2008 4:05 PM\"  LongDate+ShortTime\r\nString.Format(\"{0:F}\", dt);  \/\/ \"Sunday, March 09, 2008 4:05:07 PM\" FullDateTime\r\nString.Format(\"{0:g}\", dt);  \/\/ \"3\/9\/2008 4:05 PM\"                ShortDate+ShortTime\r\nString.Format(\"{0:G}\", dt);  \/\/ \"3\/9\/2008 4:05:07 PM\"             ShortDate+LongTime\r\nString.Format(\"{0:m}\", dt);  \/\/ \"March 09\"                        MonthDay\r\nString.Format(\"{0:y}\", dt);  \/\/ \"March, 2008\"                     YearMonth\r\nString.Format(\"{0:r}\", dt);  \/\/ \"Sun, 09 Mar 2008 16:05:07 GMT\"   RFC1123\r\nString.Format(\"{0:s}\", dt);  \/\/ \"2008-03-09T16:05:07\"             SortableDateTime\r\nString.Format(\"{0:u}\", dt);  \/\/ \"2008-03-09 16:05:07Z\"            UniversalSortableDateTime\r\n<\/pre>\n<p>\ucc38\uc870 : http:\/\/www.csharp-examples.net\/string-format-datetime\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123); String.Format(&#8220;{0:y yy yyy yyyy}&#8221;, dt); \/\/ &#8220;8 08 008 2008&#8221; year String.Format(&#8220;{0:M MM MMM MMMM}&#8221;, dt); \/\/ &#8220;3 03 Mar March&#8221; month String.Format(&#8220;{0:d dd ddd dddd}&#8221;, dt); \/\/ &#8220;9 09 Sun Sunday&#8221; day String.Format(&#8220;{0:h hh H HH}&#8221;, dt); \/\/ &#8220;4 04 16 16&#8221; hour\u2026 <span class=\"read-more\"><a href=\"https:\/\/csharp.ihavenomoney.co.kr\/?p=718\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[],"class_list":["post-718","post","type-post","status-publish","format-standard","hentry","category-c-form"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=718"}],"version-history":[{"count":2,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/718\/revisions"}],"predecessor-version":[{"id":720,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/718\/revisions\/720"}],"wp:attachment":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}