Olá!
Set Date British
? hb_Date() --> 24/05/2021
? Time() --> 16:37:12
? hb_DateTime() --> 24/05/2021 16:37:19.979 // Este formato é um timestamp. Em XML usa-se 24/05/2021T16:37:19.979
? hb_DtoT(hb_Date(), 82000 ) --> 24/05/2021 22:46:40.000
cjp escreveu:como faço para convertê-lo num texto?
o 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.
o 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.
o 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.
o 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).
o 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.
o hb_TSToUTC( [<tLocalTime>] ) ➜ tUtcTime Converts a local time tTIMESTAMP to UTC time.
o hb_TtoC( <dDate>|<tTimeStamp> [, <cDateFormat>, <cTimeFormat>] ) ➜ cTimeStamp Converts date or timestamp values to timestamp formatted strings.
o 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.
o hb_TtoN( <dDate>|<tTimeStamp> ) ➜ nValue Converts a date or timestamp value to numeric value. The integer part of returned <nValue> is the date part represented as a Julian date value, and the decimal part is the time part represented as milliseconds from midnight.
NOTE: the returned nValue must not be confused with Unix time number, since they're totally different!o hb_TtoS( <dDate>|<tTimeStamp> ) ➜ cDateTime Converts a date or timestamp value to string formated as YYYYMMDDHHMMSSFFF.
o hb_TToHour( <tTimeStamp> ) ➜ nHourso hb_TToMin ( <tTimeStamp> ) ➜ nMinuteso hb_TToSec ( <tTimeStamp> ) ➜ nSecondso hb_TToMSec( <tTimeStamp> ) ➜ nMilliseconds The above four functions calculate/convert the <tTimeStamp> timestamp value to hours, minutes, seconds and milliseconds respectively.
All but hb_TToMSec() functions return a floating point number, where the fractional part represents the rest (decimal remainder) of the conversion. The hb_TToMSec() function returns milliseconds as an integer value.
NOTE: they are new functions, available for use after 2016-12-15 12:51 UTC+0100 commit (they are not available in earlier Harbour versions).Fonte:
Petewg/harbour-core
https://github.com/Petewg/harbour-core/wiki/hb_Dhttps://github.com/Petewg/harbour-core/wiki/hb_TNewDateTimeFunctions