function dateformat(datestr,types)
dim datestring
if isdate(datestr) = false then
datestring = ""
end if
select case types
case "1"
datestring = year(datestr)&"-"&month(datestr)&"-"&day(datestr)
case "2"
datestring = year(datestr)&"."&month(datestr)&"."&day(datestr)
case "3"
datestring = year(datestr)&"/"&month(datestr)&"/"&day(datestr)
case "4"
datestring = month(datestr)&"/"&day(datestr)&"/"&year(datestr)
case "5"
datestring = day(datestr)&"/"&month(datestr)&"/"&year(datestr)
case "6"
datestring = month(datestr)&"-"&day(datestr)&"-"&year(datestr)
case "7"
datestring = month(datestr)&"."&day(datestr)&"."&year(datestr)
case "8"
datestring = month(datestr)&"-"&day(datestr)
case "9"
datestring = month(datestr)&"/"&day(datestr)
case "10"
datestring = month(datestr)&"."&day(datestr)
case "11"
datestring = month(datestr)&"月"&day(datestr)&"日"
case "12"
datestring = day(datestr)&"日"&hour(datestr)&"時"
case "13"
datestring = day(datestr)&"日"&hour(datestr)&"點"
case "14"
datestring = hour(datestr)&"時"&minute(datestr)&"分"
case "15"
datestring = hour(datestr)&":"&minute(datestr)
case "16"
datestring = year(datestr)&"年"&month(datestr)&"月"&day(datestr)&"日"
case else
datestring = datestr
end select
dateformat = datestring
end function
格式化日期
格式化日期 輸出形式取決於使用者計算機的文化設定。using system using system.globalization public class mainclass string date for int i 0 i format.length i d 07 11 2004 輸出 d su...
日期格式化
日期轉化一 為了達到不同的顯示效果有時,我們需要對時間進行轉化,預設格式為 2007 01 03 14 33 34 要轉化為其他格式,要用到datetime.tostring的方法 string,iformatprovider 如下所示 using system using system.globa...
日期格式化
時間限制 400 ms 記憶體限制 65536 kb 長度限制 8000 b 判題程式 standard 作者陳越 世界上不同國家有不同的寫日期的習慣。比如美國人習慣寫成 月 日 年 而中國人習慣寫成 年 月 日 下面請你寫個程式,自動把讀入的美國格式的日期改寫成中國習慣的日期。輸入格式 輸入在一行...