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

Compare with Current View Page History

« Previous Version 7 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/timeInteger


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


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


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/timeInteger


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

LocalThe date/time converted to local server timeDateTime

MillisecondThe millisecond component of the date/timeInteger

MinuteThe minute component of the date/timeInteger

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

MonthThe month component of the date/timeInteger

SecondThe second component of the date/timeInteger

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

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/timeInteger






  • No labels