You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

The datetime object represents a combined date and time value and includes properties, and functions to extract numbers, convert between local and UTC, and convert to a string representation. Note that the local date and time value and formatting output is based on the timezone and regional settings of the server or agent where the expression is evaluated.

NameDescriptionReturn TypeUsage Examples
DayThe day component of the date/timenumber

DayOfWeekThe name of the day of week of the date/timestring

DaysAgoThe number of days which have passed since the date/timenumber

Format(string format)Formats a date or time value using standard or custom .Net formatting stringsstring$Server.Now.Format("hh:mm")$"23:55" (given the date time "31/12/2000 23:55:333")
HourThe hour component of the date/timenumber

HoursAgoThe number of hours which have passed since the date/timenumber

LocalThe date/time converted to local server timeDateTime

MillisecondThe millisecond component of the date/timenumber

MinuteThe minute component of the date/timenumber

MinutesAgoThe number of minutes which have passed since the date/timenumber

MonthThe month component of the date/timenumber

SecondThe second component of the date/timenumber

SecondsAgoThe number of seconds which have passed since the date/timenumber

ToLongDateString()The date/time represented in long date format. For the en-AU culture, the standard long date pattern is "dddd, d MMMM yyyy".string

ToLongTimeString()The date/time represented in long time format. For the en-AU culture, the standard long time pattern is "h:mm:ss tt".string

ToShortDateString()The date/time represented in short date format. For the en-AU culture, the standard short date pattern is "d/MM/yyyy"string

ToShortTimeString()The date/time represented in short time format. For the en-AU culture, the standard short time pattern is "h:mm tt"string

UTCThe date/time converted to Coordinated Universal Time (UTC)DateTime

YearThe year component of the date/timenumber






  • No labels