Return to Language Reference home pageHarbour API Explorer
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Only APIs with Curated Documentation are available from this screen.
Most API (functions) description comes from https://github.com/Petewg/harbour-core/wiki. Same content license applies.
To search all Harbour Core, Contribs and Packages APIs, including undocumented ones, go to Source Code Explorer.
Found 86 APIs
ADays() ➔ <aDays>

Returns an array with all the days names in the selected current language.


AddMonth([<dDate>],<nMonths>) ➔ <dShiftedDate>

Specifies the number of months from the date. If nMonths is positive, AddMonth( ) returns a date that is nMonthsmonths after the date. If nMonths is negative, AddMonth( ) returns a date that is nMonths months before the date. For example, -1 means -31 days.


AMonths() ➔ <aMonths>

Returns an array with all the months names in the selected current language.


AMPM([<cTime>]) ➔ <cTime>

Returns the [<cTime>] time string in 12-hour format HH:MM pm/am or HH:MM:SS pm/am, depending if the SS (seconds) was also provided. The hour (HH) part is displayed as a <= 12 value and an added suffix which is either am if [<cTime>] is an 'ante meridiem' (before midday) hour or pm if it is 'post meridiem' (after midday).
If [<cTime>] is not given the function returns 12 am.


BoM(<dDate>) ➔ <dDateBeginOfMonth>

Returns begin date Of Month, (e.g: 01/MM/YY)


BoY(<dDate>) ➔ <dDateBeginOfYear>

Returns the first date of a given year date.


CDoW(<dDate>) ➔ <cDayName>

Returns the name of a week day from a date. If <dDate> is an empty date, the function returns a null string ("").


CMonth(<dDate>) ➔ <cMonth>

Returns the name of a month from a date. If <dDate> is an empty date, the function returns a null string ("").


CtoD(<cDateString>) ➔ <dDate>

Converts a character string into a Date value. If <cDateString> is not a valid date string or is empty, an empty date is returned.
NOTE: The result is affected by the current SET DATE/SET DATE FORMAT and SET EPOCH settings, which may lead to unexpected/incorrect results. For conversions between DATE to CHARACTER and vice-versa, use DtoS()/StoD() that are independent of those settings.


CToDoW(<cName>) ➔ <nOrdinal>

Converts name of day of the week to its ordinal number.


CToMonth(<cName>) ➔ <nOrdinal>

Converts name of month to its ordinal number.


CTOT => hb_CtoT(<cTimeStamp>,[<cDateFormat>],[<cTimeFormat>]) ➔ <tTimeStamp>

Converts a timestamp string to timestamp value (valtype=T). By default it uses the _SET_DATEFORMAT and _SET_TIMEFORMAT format strings to do the conversion, but you can specify other formats using <cDateFormat> and <cTimeFormat>.


Date() ➔ <dCurDate>

Returns the current system date as reported by the system clock.


DATETIME => hb_DateTime([<nYear>],[<nMonth>],[<nDay>],[<nHour>],[<nMinute>],[<nSecond>],[<nFragment>]) ➔ <tTimeStamp>

Returns a timestamp value from the supplied day, month, year, hour, minute, second and second-fragment values. If none of them is supplied, the current date and time is returned.


Day(<dDate>) ➔ <nDay>

Returns the numeric day of the month of <dDate>. When <dDate> is an empty date, the function returns zero.


Days(<nSecs>) ➔ <nDay>

Converts <nSecs> seconds to the equivalent number of days.


DaysInMonth(<nMonth>,<lLeapYear>) ➔ <nDaysInMonth>

Returns the number of days in month.


DaysToMonth(<nMonth>,<lLeapYear>) ➔ <nDaysToMonth>

Return total number of days from first of Jan to beginning of <nMonth>. (xhb library, been put here for reminder).


DMY([<dDate>],[<lMode>]) ➔ <cDateString>

Returns the date as a string in DD Month YY format.
Will be affected by "set century on".
Example: 24. November 2020


DoW(<dDate>) ➔ <nDay>

Returns the day of the week as a number between 1 and 7 or 0 if <dDate> is empty. The first day of the week is 1 (Sunday) and the last day is 7 (Saturday).


DoY([<dDate>]) ➔ <nDayOfYear>

Returns a calendar day number that specifies which day of the year <dDate> represents. If dDate is NULL, the system date is used. An empty or invalid date returns 0.


DToC(<dDate>) ➔ <cDate>

Converts a date value to string. returned value is formatted in the current date format (default: mm/dd/yy). A null date returns a string of spaces equal in length to the current date format.
NOTE: The result is affected by the current SET DATE/SET DATE FORMAT and SET EPOCH settings, which may lead to unexpected/incorrect results. For conversions between DATE to CHARACTER and vice-versa, use DtoS()/StoD() that are independent of those settings.


DToS(<dDate>) ➔ <cDate>

Returns a character string in YYYYMMDD format. If <dDate> is empty returns an eight spaces long string.


ElapTime(<cStartTime>,<cEndTime>) ➔ <cDiference>

Returns a time-formatted character string holding the duration of the time interval in the format hh:mm:ss.


EoM([<dDate>]) ➔ <dDateEndOfMonth>

Returns the last day of a given month date.


EoY([<dDate>]) ➔ <dDateEndOfYear>

Returns the last date of a given year date.


hb_BuildDate() ➔ <cBuildDateTime>

Returns Harbour build DateTime in the form: MONTHNAME N YYYY HH:MM:SS (f.e: May 5 2016 10:04:52)


hb_CDay(<nDay>) ➔ <cDayName>

Returns the name of day specified by <nDay>. Valid range [ 1 ... 7 ]. Returns empty string if <nDay> is out of valid range. Runtime error occurs if <nDay> is NIL (i.e. not passed).
Worth noting that the returned value is identical to that of CDoW() but the later accepts a date value as parameter.


hb_Clocks2Secs(<nClocks>) ➔ <nSecs>

Returns CPU clocks converted to seconds.


hb_CtoD(<cDate>,[<cDateFormat>]) ➔ <dDate>

Harbour extension to the CtoD() function. It converts a string <cDate> representing a date to a DATE type value. Additionally, the date format used in <cDate> can be supplied in <cDateFormat>, otherwise the _SET_DATEFORMAT format will be used.


hb_CtoT(<cTimeStamp>,[<cDateFormat>],[<cTimeFormat>]) ➔ <tTimeStamp>

Converts a timestamp string to timestamp value (valtype=T). By default it uses the _SET_DATEFORMAT and _SET_TIMEFORMAT format strings to do the conversion, but you can specify other formats using <cDateFormat> and <cTimeFormat>.


hb_Date([<nYear>],[<nMonth>],[<nDay>]) ➔ <dDate>

Harbour extension to the Date() function that returns a date value from the supplied day, month and year values. If any of them is invalid or missing, an empty date is returned. If none of them is supplied, the current date is returned.


hb_DateTime([<nYear>],[<nMonth>],[<nDay>],[<nHour>],[<nMinute>],[<nSecond>],[<nFragment>]) ➔ <tTimeStamp>

Returns a timestamp value from the supplied day, month, year, hour, minute, second and second-fragment values. If none of them is supplied, the current date and time is returned.


hb_DtoC(<dDate|tTimeStamp>,[<cDateFormat>]) ➔ <cDate>

Harbour extension to the DtoC() function. It converts a date value <dDate> (or the date value of <tTimeStamp>) to a string. If no date format is supplied the _SET_DATEFORMAT format will be used.


hb_DtoT(<dDate>,[<cnTime>]) ➔ <tTimeStamp>

Returns a timestamp from the date and time values. <dDate> is a date value and <cnTime> is the time part and could be a number (as from Seconds()) or a string (as from Time()), (see time string format).


hb_FSetDateTime(<cFileName>,[<dDate | tDateTime>],[<cTime HH;MM;SS>]) ➔ <lSuccess>

Sets last changed date/time to <cFileName>. If invalid date passed, the current system date/time will be used/set.
If the second parameter is a timestamp (datetime) the third parameter is ignored.


hb_Hour(<tTimeStamp>) ➔ <nHour>

Returns the hour (HH) part or "member" of a TimeStamp.


hb_IsDate(<xExp>) ➔ <lResult>

Determines if <xExp> evaluates to date value (valtype "D").


hb_IsDateTime(<xExp>) ➔ <lResult>

Determines if <xExp> evaluates to a timestamp (valtype "T") or a date (valtype "D") value.


hb_IsTimestamp(<xExp>) ➔ <lResult>

Determines if <xExp> evaluates to a timestamp (valtype "T).


hb_Minute(<tTimeStamp>) ➔ <nMinute>

Returns the minute (mm) part (or "member") of a <tTimeStamp>.


hb_MSecToT(<nMilliseconds>) ➔ <tDateTime>

Converts milliseconds to <tTimestamp> value.


hb_NToHour(<nTimeDiff>) ➔ <nHours>

Convert the <nTimeDiff> time difference to hours.
The returned value is a floating point number with fractional part representing the rest (decimal remainder) of conversion.
Note 1: new functions, available after [2016-12-15 12:51 UTC+0100]
Note 2: These functions must not be confused with similarly named hb_Hour() since the above ones do convert the numeric time difference (time span) between two timestamps while the other ones just extract specific hours of a given timestamp.


hb_NToMin(<nTimeDiff>) ➔ <nMinutes>

Convert the <nTimeDiff> time difference to minutes.
The returned value is a floating point number with fractional part representing the rest (decimal remainder) of conversion.
Note 1: new functions, available after [2016-12-15 12:51 UTC+0100]
Note 2: This function must not be confused with similarly named hb_Minutes() since the above ones do convert the numeric time difference (time span) between two timestamps while the other ones just extract specific minutes of a given timestamp.


hb_NToMSec(<nTimeDiff>) ➔ <nMilliseconds>

Convert the <nTimeDiff> time difference to milliseconds.
The returned value is an integer which represents milliseconds value.


hb_NToSec(<nTimeDiff>) ➔ <nSeconds>

Convert the <nTimeDiff> time difference to seconds.
The returned value is a floating point number with fractional part representing the rest (decimal remainder) of conversion.
Note 1: new functions, available after [2016-12-15 12:51 UTC+0100]
Note 2: This function must not be confused with similarly named hb_Sec() since the above ones do convert the numeric time difference (time span) between two timestamps while the other ones just extract specific seconds of a given timestamp.


hb_NtoT(<nValue>) ➔ <tTimeStamp>

Converts the given numeric time-value <nValue> (which, supposedly, is a Unix time value) to a timestamp (i.e. valtype == T).


hb_Sec(<tTimeStamp>) ➔ <nSecond>

Returns the seconds (ss) "member" of a tTimeStamp. The returned value is a floating point number (ss.mmm) where the integer part is seconds while the decimal (fraction) part of it represents milliseconds.


hb_SecToT(<nSeconds>) ➔ <tTime>

Converts <nSeconds> seconds to tTimestamp value.


hb_StoD(<cDate>) ➔ <dDate>

Converts a string representing a date with the format YYYYMMDD to a date value. If no <cDate> is supplied, an empty date string will be returned. Counterpart of the standard DtoS() function.


hb_StoT(<cDateTime>) ➔ <tTimeStamp>

Converts a datetime string to timestamp value (T).
<cDateTime> should be in one of the above form:
- "YYYYMMDDHHMMSSFFF"
- "YYYYMMDDHHMMSSFF"
- "YYYYMMDDHHMMSSF"
- "YYYYMMDDHHMMSS"
- "YYYYMMDDHHMM"
- "YYYYMMDDHH"
- "YYYYMMDD"
- "HHMMSSFFF"
- "HHMMSSF"
- "HHMMSS"
- "HHMM"
- "HH"


hb_StrToTS(<cTimeStamp>) ➔ <tTimeStamp>

Converts a string cTimeStamp to tTimeStamp timestamp value. The <cTimeStamp> must have the format: YYYY-MM-DD [H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM] or YYYY-MM-DDT[H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM].


hb_TSToStr(<tTimeStamp>,[<lPacked>]) ➔ <cTimeStamp>

Returns <cTimeStamp> with the format YYYY-MM-DD hh:mm:ss.fff. If <lPacked> is .T. empty elements of the timestamp will be stripped out.


hb_TSToUTC(<tLocalTime>) ➔ <tUtcTime>

Converts a local time tTIMESTAMP to UTC time.


hb_TtoC(<dDate|tTimeStamp>,[<cDateFormat>],[<cTimeFormat>]) ➔ <cTimeStamp>

Converts date or timestamp values to timestamp formatted strings.


hb_TtoD(<dDate|tTimeStamp>,[<@nSeconds|cTime>],[<cTimeFormat>]) ➔ <dDate>

Extracts date and time information from a timestamp or date value. It returns the date part as a date value. If <@nSeconds> or @<cTime> parameter is passed by reference then it obtains either the number of seconds in given day specified by timestamp value or the time as time string. If no <cTimeFormat> passed, then _SET_TIMEFORMAT is used.


hb_TToMin(<tTimeStamp>) ➔ <nMinutes>

Calculate/Convert timestamp to minutes.
Returns a floating point number, where the fractional part represents the rest (decimal remainder) of the conversion.


hb_TToMSec(<tTimeStamp>) ➔ <nMilliseconds>

Calculate/Convert timestamp to milliseconds.
Returns milliseconds as an integer value.


hb_TtoS(<dDate|tTimeStamp>) ➔ <cDateTime>

Converts a date or timestamp value to string formated as YYYYMMDDHHMMSSFFF.


hb_TToSec(<tTimeStamp>) ➔ <nSeconds>

Calculate/Convert timestamp to seconds.
Returns a floating point number, where the fractional part represents the rest (decimal remainder) of the conversion.


hb_UTCOffset(<tLocalTime>) ➔ <nSeconds>

Returns the UTC offset as a signed number of seconds.


hb_Week(<dDate>,[<@nYear>],[<@nDayOfWeek>]) ➔ <nWeek>

Returns the week number of year, for the given <dDate>. Worth to note that the returned value is ISO 8601 compliant.
With this function can also obtained the year and/or the day-number of the week, into <nYear> and <nDayOfWeek> optional parameters, provided they've been passed by reference.
WARNING! 1st day of the week according to ISO 8601 is _Monday_ (and not _Sunday_, as it's widely regarded to be). This may lead to inaccurate/confusing results when the number returned into <nDayOfWeek> is being used as an argument on calling non-ISO 8601-conforming date functions like, for example, hb_CDay(). In such cases, either use _Dow()_ to determine the day number of the week or alternatively _increment by 1_ the <nDayOfWeek> value or pre-increment it with ++ operator, i.e.: hb_CDay( ++nDayOfWeek ).


HOUR => hb_Hour(<tTimeStamp>) ➔ <nHour>

Returns the hour (HH) part or "member" of a TimeStamp.


IsLeap([<dDate>]) ➔ <lIsLeap>

Checks if year of <dDate> is a leap year. If no <dDate> passed, the system date is used.


IsLeapYear(<dDate>) ➔ <lTrueOrFalse>

Checks if year of <dDate> is a leap year. If no <dDate> passed, result is .F., which means <dDate> is essential, in order to get correct result.


Max(<xExp1>,<xExp2>) ➔ <xLargest>

Returns the larger numeric, date, datetime or logic value. On logic value larger is .T.


MDY([<dDate>]) ➔ <cDateString>

Returns the date as a string in Month DD, YY or Month DD, YYYY. If <dDate> is NULL, the system date is used.


Min(<xExp1>,<xExp2>) ➔ <xSmallest>

Returns the smallest numeric, date, datetime or logic value. On logic value smaller is .F.


MINUTE => hb_Minute(<tTimeStamp>) ➔ <nMinute>

Returns the minute (mm) part (or "member") of a <tTimeStamp>.


Month(<dDate>) ➔ <nMonth>

Returns an integer numeric value in the range of zero to 12. A null <dDate> returns zero.


NToCDoW(<nDayOfWeek>) ➔ <cDay>

Returns the day name of <nDayOfWeek>. Returns empty string on empty/invalid (not in range 1-7) <nDayOfWeek>.


NToCMonth(<nMonth>) ➔ <cMonth>

The month name of <nMonth>. Returns empty string on empty/invalid <nMonth> (e.g. not in range 1-12)


Seconds() ➔ <nSecondsHundredths>

Returns the system time as a numeric value in the form sssss.ff (range: 0.00 - 86399.99), which number is in fact, the number of seconds elapsed since midnight, based on a twenty-four hour clock.


Secs(<cTime>) ➔ <nSeconds>

Converts <cTime> to seconds (integer). For empty or invalid <cTime> returns 0.


SecToTime(<nSec>,[<lHundredth>]) ➔ <cTime>

Will convert numeric with 2 decimals to HH:MM:SS or HH:MM:SS:hh if is true.
Max value can be 23:59:59:99


StoD([<cDate>]) ➔ <dDate>

Converts a date string to date value formatted as yyyymmdd.


STOT => hb_StoT(<cDateTime>) ➔ <tTimeStamp>

Converts a datetime string to timestamp value (T).
<cDateTime> should be in one of the above form:
- "YYYYMMDDHHMMSSFFF"
- "YYYYMMDDHHMMSSFF"
- "YYYYMMDDHHMMSSF"
- "YYYYMMDDHHMMSS"
- "YYYYMMDDHHMM"
- "YYYYMMDDHH"
- "YYYYMMDD"
- "HHMMSSFFF"
- "HHMMSSF"
- "HHMMSS"
- "HHMM"
- "HH"


Time() ➔ <cTimeString>

Returns system time formatted as hh:mm:ss.


TimeToSec(<cTime>) ➔ <nSeconds>

Will convert HH:MM:SS or HH:MM:SS:hh to numeric with 2 decimals
Max value can be 86399.99


TimeValid(<cTime>) ➔ <lValid>

Returns .T. when <cTime> is a valid time or .F. otherwise.


TTOC => hb_TtoC(<dDate|tTimeStamp>,[<cDateFormat>],[<cTimeFormat>]) ➔ <cTimeStamp>

Converts date or timestamp values to timestamp formatted strings.


TTOS => hb_TtoS(<dDate|tTimeStamp>) ➔ <cDateTime>

Converts a date or timestamp value to string formated as YYYYMMDDHHMMSSFFF.


WaitPeriod(<nDelay>) ➔ <lNotElapsed>

Returns .T. , if the time span specified by <nDelay> has not elapsed. <nDelay> is the waiting period given in 1/100 of seconds. Values can range from 1 to 8.640.000 (one day).


Week([<dDate>],[<bSWN>]) ➔ <Numeric>

Returns a sequential week number that designates in which week of the year <dDate> lies.
if <bSWN> is .T. it seems the number of weeks is full weeks since the beginning of the year, not the calendar week number.


WoY(<dDate>,<lIso>) ➔ <nWeek>

Returns the week number of the year for a given date. It returns ISO-based week number, i.e. in range 1..53, by default (or passing TRUE as second parameter), or in range 1..53 if lIso is FALSE.


Year(<dDate>) ➔ <nYear>

Returns the year of <dDate> as a four-digit numeric value. An empty dDate returns 0.