码迷,mamicode.com
首页 > 其他好文 > 详细

DateTime Related Functions

时间:2014-08-05 00:02:48      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:http   os   strong   io   for   ar   cti   sql   

 

 

The Oracle/PLSQL TO_DATE function converts a string to a date.

TO_DATE( string1, [ format_mask ], [ nls_language ] )

Parameters or Arguments

string1 is the string that will be converted to a date.

format_mask is optional. This is the format that will be used to convert string1 to a date.

nls_language is optional. This is the nls language used to convert string1 to a date.

TO_DATE(‘2003/07/09‘, ‘yyyy/mm/dd‘) would return a date value of July 9, 2003
TO_DATE(‘070903‘, ‘MMDDYY‘) would return a date value of July 9, 2003
TO_DATE(‘20020315‘, ‘yyyymmdd‘) would return a date value of Mar 15, 2002

 

String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9/3/2008 16:05:07" - english (en-US)

String.Format("{0:t}", dt);  // "4:05 PM"                         ShortTime
String.Format("{0:d}", dt);  // "3/9/2008"                        ShortDate
String.Format("{0:T}", dt);  // "4:05:07 PM"                      LongTime
String.Format("{0:D}", dt);  // "Sunday, March 09, 2008"          LongDate
String.Format("{0:f}", dt);  // "Sunday, March 09, 2008 4:05 PM"  LongDate+ShortTime
String.Format("{0:F}", dt);  // "Sunday, March 09, 2008 4:05:07 PM" FullDateTime
String.Format("{0:g}", dt);  // "3/9/2008 4:05 PM" ShortDate+ShortTime
String.Format("{0:G}", dt);  // "3/9/2008 4:05:07 PM"             ShortDate+LongTime
String.Format("{0:m}", dt);  // "March 09"                        MonthDay
String.Format("{0:y}", dt);  // "March, 2008"                     YearMonth
String.Format("{0:r}", dt);  // "Sun, 09 Mar 2008 16:05:07 GMT"   RFC1123
String.Format("{0:s}", dt);  // "2008-03-09T16:05:07"             SortableDateTime
String.Format("{0:u}", dt);  // "2008-03-09 16:05:07Z"            UniversalSortableDateTime

http://msdn.microsoft.com/en-us/library/26etazsy(v=vs.110).aspx

 

DateTime Related Functions,布布扣,bubuko.com

DateTime Related Functions

标签:http   os   strong   io   for   ar   cti   sql   

原文地址:http://www.cnblogs.com/kevinygq/p/3890988.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!