参数format格式详细用法 格式字符 关联属性/说明 d ShortDatePattern D LongDatePattern f 完整日期和时间(长日期和短时间) F FullDateTimePattern(长日期和长时间) g 常规(短日期和短时间) G 常规(短日期和长时间) m、M MonthDayPattern r、R RFC1123Pattern s 使用当地时间的 SortableDateTimePattern(基于ISO8601) t ShortTime
因为短日期不足2位,所以在网页排版的时候,影响美观,下面两个函数可以解决这个问题。
2020-2-7短日期 变 2020-02-07长日期
Function FStime(times)
Dim years,months,days
if len(times)=0 then exit function
years=year(times)
months=right("0"&month(times),2)
days=right("0"&day(times),2)
ti
代码如下: public function fillzero(l1) if len(l1)=1 then fillzero=”0″&l1 else fillzero=l1 end if end function 用法示例: 代码如下: response year(now)&month(now)&day(now) 结果:201116 response year(now)&fillzero(month(now))&fillzero(day(now)) 显示结果:20110106 如何控制长日期
代码如下:using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace