Home
SQL Size online help Prev Page Prev Page
Introduction
About SQL Size
Version history
Contact us
User Guide
Architecture
Licensing
Installation
System requirements
Reference Guide
The SQL Size Agent service
The SQL Size Configuration application
SQL Server instances
Data collection schedule
Reports and emails
Report template
Data storage
Alerts
Script editor
Useful shortcuts
Activating your license
The SQL Size database
The SQL Size GUI
The Overview page
Export overview
Database analysis
Alerts history
Error history
Scripting
Data types
Script structure
Language basics
Debugging
Global variables
Functions
Alert functions
RaiseAlert
RaiseConditionalAlert
AddAlertDetails
Mathematical functions
Power
String formatting functions
FormatBytes
FormatFloat
Support functions
String functions
Date and time functions
Date-Time format strings
Class reference
TBaseClass
Properties
AverageDailyGrowth
Name
ObjectType
Size
SizeDesc
Tag
TInstance
Properties
Database
DatabaseByName
DatabaseCount
DatabaseDataSize
DatabaseExists
DatabaseFilestreamSize
DatabaseLogSize
DatabaseSize
PathCount
Path
TDatabase
Properties
DataSize
DBFile
DBFileCount
Filegroup
FilegroupCount
FilestreamSize
LogSize
TFilegroup
Properties
DBFile
DBFileCount
FilegroupType
TDBFile
Properties
Filegroup
FileType
Growth
IsPercentGrowth
MaxSize
Path
PhysicalName
TPath
Properties
FreeSpace
Enumerations
TFileType
TFilegroupType
TObjectType
Records
TGrowthStats
Constants

Date and time functions

Date time values are stored as floating point values. The integer portion stores the number of days that have passed since 12/30/1899. The fractional part of the float value is fraction of a 24 hour day that has elapsed.

To display dates and times as strings, use the DateTimeToStr, DateToStr, TimeToStr and FormatDateTime functions.
 
function Now: Float; 
Returns the current date and time.  
 
function Date: Float; 
Returns the current date.  
 
function Time: Float; 
Returns the current time.  
 
function UTCDateTime: Float; 
Returns the current UTC date and time.  
 
function DateTimeToStr(DateTimeValue: Float): string; 
Returns the DateTimeValue as a string.  
 
function DateToStr(DateValue: Float): string; 
Returns DateValue as a string.  
 
function TimeToStr(TimeValue: Float): string; 
Returns TimeValue as a string.  
 
function FormatDateTime(Format: string; DateTimeValue: Float): string; 
Formats DateTimeValue using Format. E.g. FormatDateTime('yyyy-mm-dd hh:nn:ss', Now) may return '2013-04-01 13:05:24'. See the Date-Time format strings topic on the supported formatting values.  
 
function DayOfWeek(Date: Float): Integer; 
Returns the day of the week for a specified date. Returns a value between 1 and 7, where Sunday is the first day of the week and Saturday is the seventh.  
 
function IsLeapYear(Year: Integer): Boolean; 
Indicates whether a specified year is a leap year.  
 
function EncodeDate(Year, Month, Day: Integer): Float; 
Returns a float value that represents a specified Year, Month, and Day. E.g. EncodeDate(2013, 4, 1) returns the float value for April 1, 2013.  
 
procedure DecodeDate(Date: Float; var Year, Month, Day: Integer); 
Returns Year, Month, and Day values for a float value.  
 
function EncodeTime(Hour, Min, Sec, MSec: Integer): Float; 
Returns a float value for a specified Hour, Min, Sec, and MSec. E.g. EncodeTime(13, 10, 20, 0) returns the float value for the time 13:10:20.000.  
 
procedure DecodeTime(Time: Float; var Hour, Min, Sec, MSec: Integer);  
Breaks a float value into hours, minutes, seconds, and milliseconds.