FoxPro/Visual FoxPro - TOMAR FECHA Y HORA..

 
Vista:

TOMAR FECHA Y HORA..

Publicado por deysi (24 intervenciones) el 11/01/2009 16:03:50
HOLA AMIGOS FORISTAS...
TENGO UNA NECESIDAD, NO SE SI SERA POSIBLE...
TENGO UN RED BAJO XP, EN UN PC (PRINCIPAL) ESTA CONCENTRADA LA DATA, Y UN SISTEMA DE ASISTENCIA. LOS DEMAS SE CONECTAN MEDIENTE UN ODBC PARA CARGAR VARIABLES.
AHORA LOS USUARIOS REGISTRAN SU ASISTENCIA, PERO TOMA LA HORA DE LA PC REMOTA DEL USIARIO...LA PREGUNTA ES.. SE PUEDE TOMAR LA HORA Y FECHA DE LA PC PRINCIPAL, NO DE LA PC REMOTA.. ¿? O ALGUNA OTRA IDEA PARA ELLO.. ?

GRACIAS DE ANTEMANO.... SALUDOS

DESYSI...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:TOMAR FECHA Y HORA..

Publicado por Miguel (115 intervenciones) el 11/01/2009 16:32:21
Utilizo esta rutina para tomar la hora del servidor principal.

uf="ruta del servidor principal"
sw_tiempo=fcreate('&uf mp iempo.txt')
mi_fecha_hora=fdate('&uf mp iempo.txt',1)
fclose(sw_tiempo)

creas un archivo en el servidor principal (&uf)

suerte.

Miguel.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:TOMAR FECHA Y HORA..

Publicado por Plinio (7841 intervenciones) el 12/01/2009 13:23:47
Portalfox tiene buenos articulo sobre el asunto:

http://www.portalfox.com/index.php?name=News&file=article&sid=621&mode=nested&order=0&thold=0

http://www.portalfox.com/index.php?name=News&file=article&sid=2484

http://www.portalfox.com/index.php?name=News&file=article&sid=1609&mode=nested&order=0&thold=0

http://www.portalfox.com/index.php?name=News&file=article&sid=183&mode=nested&order=0&thold=0
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:TOMAR FECHA Y HORA..

Publicado por Eduardo Daniel (123 intervenciones) el 12/01/2009 19:00:22
Hola, lo que hago yo es con un bat en el inicio de cada PC, tomar la hora del server principal

net time \servidor :yes
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:TOMAR FECHA Y HORA..

Publicado por Plinio (7841 intervenciones) el 14/01/2009 01:40:28
NO creo que sea funcional solo en el inicio. Una porque la hora cambia y otra porque de seguros tendras clientes que no apagan el computador.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 4
Ha aumentado su posición en 2 puestos en FoxPro/Visual FoxPro (en relación al último mes)
Gráfica de FoxPro/Visual FoxPro

RE:TOMAR FECHA Y HORA..

Publicado por kong (682 intervenciones) el 14/01/2009 07:33:29
en mi caso, igualo la hora del servidor con una API

y es copiada

*--------------------------------------------------------------
* FUNCTION NetDateTime(tcSrv, tlSet)
*--------------------------------------------------------------
* Retorna la fecha-hora de la PC remota "tcSrv"
* Si "tlSet" es .T. cambia la hora de la PC
* por la fecha-hora de la PC remota "tcSrv"
* PARAMETROS:
* tcSrv: Nombre de la PC remota
* tlSet: .T. - Si cambia la hora de la PC
* RETORNO:
* DateTime: La fecha-hora de la PC remota
* Num¨¦rico: 0 - Si se cambi¨® la fecha-hora correctamente
* -1 - No se pudo cambiar la fecha-hora
* -2 - No se encontr¨® la PC remota
* USO: ? NetDateTime("\MiServidor", .F.)
* AUTOR: LMG
*--------------------------------------------------------------
*?netdatetime("\caja1",.t.)
FUNCTION F_NETDATETIME(tcSrv, tlSet)
tcSrv="\"+UPPER(STREXTRACT(tcSrv,"\","")) &&ESTA LINEA ES PROPIO DE KONG
LOCAL lRet, lcStrDW, lnPtr, lcToD, lpTZI, ln, lnZT, ;
lnAno, lnMes, lnDDS, lnDia, lnHor, lnMin, lnSeg
DECLARE INTEGER NetRemoteTOD IN NETAPI32 ;
STRING @lcSvr, ;
INTEGER @lnPtr
DECLARE RtlMoveMemory IN WIN32API ;
STRING @lcToD, ;
INTEGER lnPtr, ;
INTEGER ln
DECLARE SetSystemTime IN WIN32API ;
STRING lcStrDW
DECLARE GetTimeZoneInformation IN KERNEL32 ;
STRING @lpTZI
tcSrv = STRCONV(STRCONV(tcSrv,1),5) + CHR(0)
lnPtr = 0
ln = NetRemoteTOD(@tcSrv, @lnPtr)
IF ln = 0
lcToD = REPLICATE(CHR(0), 48)
ln = RtlMoveMemory(@lcToD, lnPtr, 48)
lnAno = DW2N(SUBSTR(lcToD, 41, 4))
lnMes = DW2N(SUBSTR(lcToD, 37, 4))
lnDDS = DW2N(SUBSTR(lcToD, 45, 4))
lnDia = DW2N(SUBSTR(lcToD, 33, 4))
lnHor = DW2N(SUBSTR(lcToD, 09, 4))
lnMin = DW2N(SUBSTR(lcToD, 13, 4))
lnSeg = DW2N(SUBSTR(lcToD, 17, 4))
IF tlSet
lcStrDW = N2DW(lnAno) + N2DW(lnMes) + ;
N2DW(lnDDS) + N2DW(lnDia) + ;
N2DW(lnHor) + N2DW(lnMin) + ;
N2DW(lnSeg) + N2DW(0)
lRet = IIF(SetSystemTime(lcStrDW), 0, -1)
ELSE
lpTZI = SPACE(255)
ln = GetTimeZoneInformation(@lpTZI)
lnZT = DW2N(SUBSTR(lpTZI, 1, 2))
IF lnZT > 720
lnZT = (2^16) - lnZT
ELSE
lnZT = (-1) * lnZT
ENDIF
lRet = DATETIME(lnAno, lnMes, lnDia, ;
lnHor, lnMin, lnSeg) + lnZT * 60
ENDIF
ELSE
lRet = -2
ENDIF
RETURN lRet
ENDFUNC

* - - - - - - - - - - - - - - - - - - - - - - - -
* FUNCTION DW2N(tcDW)
* Usada por NetDateTime()
* - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION DW2N(tcDW)
RETURN ASC(SUBSTR(tcDW, 4, 1))*(256^3) + ;
ASC(SUBSTR(tcDW, 3, 1))*(256^2) + ;
ASC(SUBSTR(tcDW, 2, 1))*(256) + ;
ASC(SUBSTR(tcDW, 1, 1))
ENDFUNC
* - - - - - - - - - - - - - - - - - - - - - - - -
* FUNCTION N2DW(tnN)
* Usada por NetDateTime()
* - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION N2DW(tnN)
RETURN CHR(MOD(tnN, 256)) + CHR(INT(tnN/256))
ENDFUNC

*--------------------------------------------------------------
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:TOMAR FECHA Y HORA..

Publicado por alexcoinc (450 intervenciones) el 14/01/2009 15:59:30
KONG

Esta rutina sirve en VFP 6.0 ??

Gracias


alexcoinc
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar