La siguiente función se hace necesaria debido a que la función Time() (nativa de VFP) no se ve afectada por la configuración de SET HOURS, la función TTOC() actúa diferente...
*********************************************************
* Function......: GetTime
* Description...: Get the current time of the local machine with 12 hours format (AM/PM)
* Parameters....: none
* Returns......: Character [11 bytes len]
* Date.........: 28-June-2004
* Autor.........: Esparta Palma esparta[arroba]softhome.net
* Comments...: To get the time with 24 hours, use native VFP Time() function.
*********************************************************
Function GetTime
LOCAL lcOldHours,; && Last Hours setting
lcRetValue &&Return Value
*** Save last setting of hours
lcOldHours = SET("HOURS")
*** Set the new Hours setting 12 hours (AM/PM)
SET HOURS TO 12
*** Get the time of the current Datetime
lcRetValue = TTOC(DATETIME(),2)
*** Set the hours setting to the saved setting
SET HOURS TO &lcOldHours
RELEASE lcOldHours
Return lcRetValue
EndFunc
Espero les sea de utilidad.
Espartaco Palma
No hay comentarios. :
Publicar un comentario
Los comentarios son moderados, por lo que pueden demorar varias horas para su publicación.