Saludos
Con mi problema de calcular la antiguedad de un empleado.
Requiero saber si existe forma o una funcion que me de los meses entre FechaInicial y FechaActual?
gracias.
Local nN
Local nM
SET DATE FRENCH
SET CENTURY ON
//? Date() - Ctod( "01/01/1961" )
nM := ( Year( Date() ) - Year( Ctod( "01/01/1961" ) ) ) * 12
nN := Month( Date() ) - Month( Ctod( "01/01/1961" ) )
if nN < 0
nN := nN + 12
endif
? nM, nN, nM + nN
*** MsgInfo( DaysInMonth( Month( date() ) ) ) // CANTIDAD DIAS DE UN MES...
*** msginfo( EoM( Date() ) ) // ULTIMA FCH.DE UN MES...
*** msginfo( Day( EoM( Date() ) ) ) // CANTIDAD DIAS DE UN MES...TOMANDO EN CUENTA LA ULTIMA FCH.DEL MES
*** Alert( NToCMonth(7) ) // NOMBRE DEL MES
***
*** "Days in month..:", daysinmonth( dDate )
*** "Day of year....:", doy( dDate )
*** "Begin of month.:", bom( dDate )
*** "End of month...:", eom( dDate )
*** "Week of month..:", wom( dDate )
*** "Week of year...:", woy( dDate )
*** "Begin of year..:", boy( dDate )
*** "End of year....:", eoy( dDate )
EDAD(FECING,FECACT)
.....
?vD,vM,vA
....
Function Edad(Fx,Fa)
Di=Day(Fx);Mi=Month(Fx);Ai=Year(Fx)-1900;Da=Day(Fa);Ma=Month(Fa);Aa=Year(Fa)-1900
If Di>Da
Da=Da+30;Ma=Ma-1
Endif
If Mi>Ma
Ma=Ma+12;Aa=Aa-1
Endi
vA=Aa-Ai
vM=Ma-Mi;vD=Da-Di
vD:=If(Day(Fx)=1,vD+1,vD)
Return .t.
*
months between Start Date and DateTime?
// note: FWLAPSED.PRG
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------//
function Main()
LOCAL dDate1, dDate2, cRetDat
SET CENTURY ON
SET DATE BRITISH
SET EPOCH TO YEAR( DATE() ) - 50
dDate1 := CTOD( "01/11/2017" )
dDate2 := CTOD( "15/12/2017" )
* New functions:
// FW_ADDTIME( dDate/tDate, "[-][nd]hh:mm:ss" )
// FW_ADDMONTH( dDate/tDate, +/- nMths )
cRetDat := FW_MTHSLAPSED( dDate1, dDate2 )
? cRetDat // Return 1 month. Thanks master Rao.
RETURN NIL
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 9 guests