久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

SQL Server 2005 Reporting Services 報(bào)表中隨意格式化日期的方法

瀏覽:59日期:2023-11-01 12:55:53

在SQL Server 2005 Reporting Services 報(bào)表中格式化日期的方法可以 FormatDateTime的函數(shù),下面是它的定義:Visual Basic (Declaration) Public Shared Function FormatDateTime ( _ Expression As DateTime, _ <OptionalAttribute> Optional NamedFormat As DateFormat = DateFormat.GeneralDate _ ) As StringVisual Basic (Usage) Dim Expression As DateTime Dim NamedFormat As DateFormat Dim returnValue As String returnValue = Strings.FormatDateTime(Expression, NamedFormat)

下面是NamedFormat 的定義:ConstantDescriptionDateFormat.GeneralDate Display a date and/or time. Display a date part as a short date. If there is a time part, display it as a long time. If present, both parts display.DateFormat.LongDate Display a date using the long date format specified in your computer's regional settings.DateFormat.ShortDate Display a date using the short date format specified in your computer's regional settings.DateFormat.LongTime Display a time using the time format specified in your computer's regional settings.DateFormat.ShortTime Display a time using the 24-hour format (hh:mm).

它的類型就這么幾種,很有限的,遠(yuǎn)遠(yuǎn)不能滿足我們的需要。那怎么辦?

實(shí)際上在報(bào)表中可以使用 ToString 的方法,來定義任意格式的字符串格式。比如:cdate(“2007-12-12 1:3:40”).ToString('yyyy-MM-dd') 可以格式化成 2007-12-12的格式,還可以格式化成12/12/2007這樣的格式,甚至可以格式化成 2007+12+12這樣的格式。這樣只要你的format 格式化字符串正確,就可以實(shí)現(xiàn)你想要的日期格式。

主站蜘蛛池模板: 宜昌市| 将乐县| 怀来县| 浦县| 岐山县| 双城市| 蓝山县| 和平区| 伊川县| 嘉义县| 板桥市| 新营市| 静宁县| 临江市| 遵义市| 崇礼县| 台湾省| 喀喇| 新干县| 昭平县| 肇州县| 黎平县| 巴林右旗| 凌云县| 神木县| 玉溪市| 咸宁市| 黄石市| 连江县| 从江县| 改则县| 鄂尔多斯市| 丹寨县| 马公市| 江源县| 诸城市| 本溪市| 贵南县| 中方县| 突泉县| 比如县|