The following functions are built-in HelpNDoc's script engine and can be used in scripts and templates:
Date/Time related functions
The TDateTime type is an alias for the Float type.
|
Function |
Description |
|
Date(): TDateTime; |
Returns the current date as a TDateTime value representing the date part. |
|
DateTimeToISO8601(dt: TDateTime): String; |
Converts the given TDateTime to an ISO 8601 string. |
|
DateTimeToISO8601(dt: TDateTime, fmt: String): String; |
Converts the given TDateTime to an ISO 8601 string with a specified precision:
|
|
DateTimeToRFC822(dt: TDateTime): String; |
Converts the given TDateTime to an RFC 822 formatted string. |
|
DateTimeToStr(dt: TDateTime): String; |
Converts the given TDateTime to a string representation. |
|
DateTimeToUnixTime(utc: TDateTime): Integer; |
Converts the given UTC TDateTime to Unix Time (seconds since 1970-01-01). |
|
DateTimeToUnixTimeMSec(utc: TDateTime): Integer; |
Converts the given UTC TDateTime to Unix Time in milliseconds. |
|
DayOfMonth(dt: TDateTime): Integer; |
Returns the day of the month from the given TDateTime. |
|
DayOfTheWeek(dt: TDateTime): Integer; |
Returns the day of the week from the given TDateTime. Returns a value from 1 through 7, where 1 indicates Monday and 7 indicates Sunday. |
|
DayOfWeek(dt: TDateTime): Integer; |
Returns the day of the week from the given TDateTime. Returns a value from 1 through 7, where 1 indicates Sunday and 7 indicates Saturday. |
|
DayOfYear(dt: TDateTime): Integer; |
Returns the day of the year from the given TDateTime. |
|
EncodeDate(y: Integer, m: Integer, d: Integer): TDateTime; |
Encodes the given year, month, and day into a TDateTime value. |
|
EncodeTime(h: Integer, m: Integer, s: Integer, ms: Integer): TDateTime |
Encodes the given time components into a TDateTime value. |
|
FirstDayOfMonth(dt: TDateTime): TDateTime; |
Returns the TDateTime of the first day of the given month. |
|
FirstDayOfNextMonth(dt: TDateTime): TDateTime; |
Returns the TDateTime of the first day of the next month. |
|
FirstDayOfNextYear(dt: TDateTime): TDateTime; |
Returns the TDateTime of the first day of the next year. |
|
FirstDayOfWeek(dt: TDateTime): TDateTime; |
Returns the TDateTime of the first day of the week from the given date. |
|
FirstDayOfYear(dt: TDateTime): TDateTime; |
Returns the TDateTime of the first day of the year from the given date. |
|
FormatDateTime(frm: String, dt: TDateTime): string; |
Formats the given TDateTime according to the specified format string. |
|
IncDay(dt: TDateTime, numberOfDays: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of days. |
|
IncHour(dt: TDateTime, numberOfHours: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of hours. |
|
IncMilliSecond(dt: TDateTime, numberOfMilliSeconds: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of milliseconds. |
|
IncMinute(dt: TDateTime, numberOfMinutes: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of minutes. |
|
IncMonth(dt: TDateTime, numberOfMonths: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of months. |
|
IncSecond(dt: TDateTime, numberOfSeconds: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of seconds. |
|
IncWeek(dt: TDateTime, numberOfWeeks: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of weeks. |
|
IncYear(dt: TDateTime, numberOfYears: Integer = 1): TDateTime; |
Increments the given TDateTime by the specified number of years. |
|
IsLeapYear(year: Integer): Boolean; |
Returns whether the given year is a leap year. |
|
ISO8601ToDateTime(s: String): TDateTime; |
Converts an ISO 8601 string to a TDateTime value. |
|
LocalDateTimeToUTCDateTime(t: TDateTime): TDateTime; |
Converts the local TDateTime to UTC TDateTime. |
|
LocalDateTimeToUnixTime(dt: TDateTime): Integer; |
Converts the local TDateTime to Unix Time (seconds since 1970-01-01). |
|
Now(): TDateTime; |
Returns the current date and time as a TDateTime value. |
|
ParseDateTime(fmt: String, str: String): TDateTime |
Parses the given string into a TDateTime value according to the specified format. |
|
RFC822ToDateTime(s: String): TDateTime; |
Converts an RFC 822 formatted string to a TDateTime value. |
|
Sleep(msec: Integer); |
Pauses execution for the specified number of milliseconds. |
|
StrToDate(str: String): TDateTime; |
Converts the given string to a TDateTime value representing the date part. |
|
StrToDateDef(str: String, def: TDateTime): TDateTime; |
Converts the given string to a TDateTime value representing the date part, returning a default value if the conversion fails. |
|
StrToDateTime(str: String): TDateTime; |
Converts the given string to a TDateTime value. |
|
StrToDateTimeDef(str: String, def: TDateTime): TDateTime; |
Converts the given string to a TDateTime value, returning a default value if the conversion fails. |
|
StrToTime(str: String): TDateTime |
Converts the given string to a TDateTime value representing the time part. |
|
StrToTimeDef(str: String, def: TDateTime): TDateTime |
Converts the given string to a TDateTime value representing the time part, returning a default value if the conversion fails. |
|
Time(): TDateTime; |
Returns the current time as a TDateTime value representing the time part. |
|
TimeToStr(dt: TDateTime): String |
Converts the given TDateTime to a string representation of the time. |
|
UnixTime(): Integer; |
Returns the current Unix Time (seconds since 1970-01-01). |
|
UnixTimeMSec(): Integer; |
Returns the current Unix Time in milliseconds. |
|
UnixTimeToDateTime(ut: TDateTime): TDateTime; |
Converts Unix Time to a TDateTime value. |
|
UnixTimeToLocalDateTime(ut: TDateTime): TDateTime |
Converts Unix Time to a local TDateTime value. |
|
UTCDateTime(): TDateTime; |
Returns the current UTC date and time as a TDateTime value. |
|
UTCDateTimeToLocalDateTime(t: TDateTime): TDateTime; |
Converts the UTC TDateTime to local TDateTime. |
|
WeekNumber(dt: TDateTime): Integer; |
Returns the week number of the given TDateTime. |
|
YearOf(dt: TDateTime): Integer; |
Returns the year part of the given TDateTime. |
|
YearOfWeek(dt: TDateTime): Integer; |
Returns the year of the week number for the given TDateTime. |
String related functions
|
Function |
Description |
|
Chr(i: Integer): Char; |
Returns the character for a specified ASCII value. |
|
DupeString(str: string; count: Integer): string; |
Returns the concatenation of a string with itself a specified number of repeats. |
|
IntToStr(i: Integer): string; |
Converts an integer to a string. |
|
StrToInt(str: string): Integer; |
Converts a string that represents an integer into a number. |
|
StrToIntDef(str: string; def: Integer): Integer; |
Converts a string that represents an integer into a number with error default. |
|
IntToHex(v: Integer; digits: Integer): string; |
Returns the hexadecimal representation of an ordinal number. |
|
HexToInt(hexa: string): Integer; |
Returns the integer value of an hexadecimal representation. |
|
BoolToStr(b: Boolean): string; |
Converts a Boolean value into a string. |
|
StrToBool(str: string): Boolean; |
Converts a string to a Boolean value. |
|
FloatToStr(f: Float): string; |
Converts a floating-point value to a string. |
|
StrToFloat(str: string): Float; |
Converts a given string to a floating-point value. |
|
StrToFloatDef(str: string; def: Float): Float; |
Converts a given string into a floating-point value, with a default error. |
|
Format(fmt: string; args array of const): string; |
Returns a formatted string assembled from a format string and an array of arguments. The following table summarizes the possible values for type:
To display the character % (that is, to display a literal %, not to begin a format specifier), use the sequence %%. Example: |
|
LowerCase(str: string): string; |
Converts a string to lowercase. |
|
UpperCase(str: string): string; |
Converts a string to uppercase. |
|
PadLeft(str: string; count: Integer; char: Char = ' '): string; |
Left-aligns a string into a fixed length text using the character specified. |
|
PadRight(str: string; count: Integer; char: Char = ' '): string; |
Right-aligns a string into a fixed length text using the character specified. |
|
Pos(needle: string; haystack: string): Integer; |
Locates a substring in a given string. Start at offset if specified. |
|
ReverseString(str: string): string; |
Returns the reverse of a specified string. |
|
SameText(str1: string; str2: string): Boolean; |
Compares two strings by ordinal value without case sensitivity. |
|
StringOfChar(ch: Char; count: Integer): string; |
Returns a string with a specified number of repeating characters. |
|
SubStr(str: string; start: Integer; Length: Integer = MaxInt): string; |
Returns a specified substring the specified string. |
|
TrimLeft(str: string): string; |
Removes blank and control characters from the left side of a string. |
|
TrimRight(str: string): string; |
Removes blank and control characters from the right side of a string. |
|
Trim(str: string): string; |
Removes blank and control characters from both sides of a string. |