当前位置:K88软件开发文章中心编程语言.NET.NET02 → 文章内容

VB.Net - 日期和时间

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:58:59

16日星期日上午12:15。.FDisplays the long date and long time according to your current culture's format. For example, Sunday, December 16, 2012 12:15:31 AM根据您当前的区域格式显示长日期和长时间。 例如,2012年12月16日星期日12:15:31 AM。.gDisplays the short date and short time according to your current culture's format. For example, 12/16/2012 12:15 AM根据您当前的区域格式显示短日期和短时间。 例如,12/16/2012 12:15 AM。.M, mDisplays the month and the day of a date. For example, December 16显示日期的月份和日期。 例如,12月16日。.R, rFormats the date according to the RFC1123Pattern property根据RFC1123Pattern属性格式化日期。.sFormats the date and time as a sortable index. For example, 2012-12-16T12:07:31将日期和时间格式化为可排序索引。 例如,2012-12-16T12:07:31。.uFormats the date and time as a GMT sortable index. For example, 2012-12-16 12:15:31Z将日期和时间格式设置为GMT可排序索引。 例如,2012-12-16 12:15:31Z。.UFormats the date and time with the long date and long time as GMT. For example, Sunday, December 16, 2012 6:07:31 PM将日期和时间格式设置为长日期和长时间,格式为GMT。 例如,星期日,2012年12月16日下午6:07:31。.Y, yFormats the date as the year and month. For example, December, 2012将日期格式设置为年和月。 例如,2012年12月。.对于其他格式,如用户定义的格式,请参阅Microsoft文档 。 属性和DateAndTime类的方法下表列出了一些DateAndTime类的常用属性 : SN属性描述1DateReturns or sets a String value representing the current date according to your system.返回或设置根据系统代表当前日期的字符串值。2NowReturns a Date value containing the current date and time according to your system.返回一个包含根据系统的当前日期和时间的日期值。3TimeOfDayReturns or sets a Date value containing the current time of day according to your system.返回或设置根据你的系统包含当天的当前时间的日期值。4TimerReturns a Double value representing the number of seconds elapsed since midnight.返回表示自午夜起经过的秒数为Double值。5TimeStringReturns or sets a String value representing the current time of day according to your system.返回或设置根据你的系统代表一天的当前时间的字符串值。6TodayGets the current date.获取当前日期。下表列出了一些DateAndTime类的常用方法 : SN方法名称和说明1 Public Shared Function DateAdd (Interval As DateInterval, Number As Double, DateValue As DateTime) As DateTime公共共享函数使用DateAdd(时间间隔为DateInterval,号码为DOUBLE,则DateValue为DATETIME)为DATETIME 返回包含已添加指定时间间隔的日期和时间值的Date值。 2 Public Shared Function DateAdd (Interval As String,Number As Double,DateValue As Object ) As DateTime公共共享函数使用DateAdd(时间间隔为字符串,数字为DOUBLE,则DateValue作为对象)为DATETIME 返回包含已添加指定时间间隔的日期和时间值的Date值。 3 Public Shared Function DateDiff (Interval As DateInterval, Date1 As DateTime, Date2 As DateTime, DayOfWeek As FirstDayOfWeek, WeekOfYear As FirstWeekOfYear ) As Long公共共享函数DateDiff(时间间隔为DateInterval,日期1为DATETIME,日期2为DATETIME,星期作为Firstdayofweek,WEEKOFYEAR作为FirstWeekOfYear)As Long 返回指定两个日期值之间的时间间隔数的长整型值。 4 Public Shared Function DatePart (Interval As DateInterval, DateValue As DateTime, FirstDayOfWeekValue As FirstDayOfWeek, FirstWeekOfYearValue As FirstWeekOfYear ) As Integer公共共享函数DATEPART(时间间隔为DateInterval,则DateValue为DATETIME,FirstDayOfWeekValue作为Firstdayofweek可,FirstWeekOfYearValue作为FirstWeekOfYear)作为整数 返回包含给定Date值的指定组件的整数值。 5 Public Shared Function Day (DateValue As DateTime) As Integer公共共享函数Day(DateValue将作为DATETIME)作为整数 返回从1到31的整数值,表示每月的某一天。 6Public Shared Function Hour (TimeValue As DateTime) As Integer公共共享函数Hour (TIMEVALUE为DATETIME)作为整数 返回从0到23的整数值,表示一天中的小时。 7 Public Shared Function Minute (TimeValue As DateTime) As Integer公共共享函数Minute(TIMEVALUE为DATETIME)作为整数 返回一个从0到59的整数值,表示小时的分钟。 8 Public Shared Function Month (DateValue As DateTime) As Integer公共共享函数Month(DateValue将作为DATETIME)作为整数 返回从1到12的整数值,表示一年中的月份。 9 Public Shared Function MonthName (Month As Integer, Abbreviate As Boolean) As String公共共享函数MONTHNAME(月为整数,简称布尔)作为字符串 返回包含指定月份的名称的字符串值。 10 Public Shared Function Second (TimeValue As DateTime) As Integer公共共享函数Second(TIMEVALUE为DATETIME)作为整数 返回从0到59,代表分钟的第二个整数值。 11 Public Overridable Function ToString As String公众可重写的ToString函数作为字符串 返回表示当前对象的字符串。 12 Public Shared Function Weekday (DateValue As DateTime, DayOfWeek As FirstDayOfWeek) As Integer公共共享函数Weekday (DateValue将作为日期时间,星期由于Firstdayofweek可)作为整数 返回包含表示星期几的一个数的整数值。 13 Public Shared Function WeekdayName (Weekday As Integer, Abbreviate As Boolean, FirstDayOfWeekValue As FirstDayOfWeek) As String公共共享函数WEEKDAYNAME(平日为整数,简称布尔,FirstDayOfWeekValue作为Firstdayofweek可)作为字符串 返回包含指定工作日名称的字符串值。 14 Public Shared Function Year (DateValue As DateTime)

上一页  [1] [2] [3] [4]  下一页


VB.Net - 日期和时间