01 Jul 2020 16:09
? hb_Dtoc( Date(), "YYYY-MM-DD" )
? hb_Dtoc( Date(), "DD-MM-YYYY" )
? hb_Dtoc( Date(), "MMDDYY" )
? hb_Dtoc( Date(), "DDMMYY" )
FUNCTION hb_Dtoc( dData, cFormato )
IF cFormato == NIL
RETURN Dtoc( dData )
ENDIF
cFormato := Upper( cFormato )
cFormato := StrTran( cFormato, "DD", StrZero( Day( dData ), 2 ) )
cFormato := StrTran( cFormato, "MM", StrZero( Month( dData ), 2 ) )
cFormato := StrTran( cFormato, "YYYY", StrZero( Year( dData ), 4 ) )
// depois do YYYY, senão trocaria o ano duas vezes
cFormato := StrTran( cFormato, "YY", StrZero( Mod( Year( dData ), 100 ), 2 ) )
RETURN cFormato
02 Jul 2020 21:27