From 148040aa595a06dbdd722a0bfa3f32630745c0c8 Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Wed, 22 May 2002 15:38:10 +0000 Subject: [PATCH] 2002-05-22 17:40 UTC+0200 Martin Vopgel --- harbour/ChangeLog | 4 ++++ harbour/contrib/libct/datetime.prg | 31 +++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bd599b6c5e..061fca23ae 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,10 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2002-05-22 17:40 UTC+0200 Martin Vopgel + * contrib/libct/datetime.prg + ! corrections supplied by Marek Horodyski + 2002-05-21 11:05 UTC+0100 Tomaz Zupan * doc/gmake.txt * Documented use of compiler cache with HB_CCACHE. diff --git a/harbour/contrib/libct/datetime.prg b/harbour/contrib/libct/datetime.prg index ab07d27d4b..5f25efe6fe 100644 --- a/harbour/contrib/libct/datetime.prg +++ b/harbour/contrib/libct/datetime.prg @@ -82,12 +82,10 @@ * $END$ */ Function BOM( date) - local yyyy date := If( ValType( date) == 'D', date, Date()) if (empty(date)) return (date) endif - yyyy := Str( Year( date), 4, 0) Return StoD( SubStr( DtoS( date), 1, 6) + '01') @@ -119,7 +117,7 @@ Function BOM( date) * $END$ */ Function EOM( date) - Local m + Local m date := If( ValType( date) == 'D', date, Date()) if (empty(date)) return (date) @@ -158,7 +156,7 @@ Function EOM( date) * $END$ */ Function BOQ( date) - Local boq, m, yyyy + Local boq AS DATE, m AS NUMERIC, yyyy AS STRING date := If( ValType( date) == 'D', date, Date()) if (empty(date)) return (date) @@ -167,11 +165,11 @@ Function BOQ( date) If ( m := Month( date)) <= 3 boq := StoD( yyyy + '0101') ElseIf m <= 6 - boq := StoD( yyyy + '0301') + boq := StoD( yyyy + '0401') ElseIf m <= 9 - boq := StoD( yyyy + '0901') + boq := StoD( yyyy + '0701') Else - boq := StoD( yyyy + '1201') + boq := StoD( yyyy + '1001') End Return boq @@ -204,19 +202,20 @@ Return boq * $END$ */ Function EOQ( date) - Local m, eoq, yyyy + Local m AS NUMERIC, eoq AS DATE, yyyy AS STRING date := If( ValType( date) == 'D', date, Date()) if (empty(date)) return (date) endif - If ( m := Month( date)) <= 12 - eoq := StoD( yyyy + '1231') - ElseIf m <= 9 - eoq := StoD( yyyy + '0930') + yyyy := NtoS( Year( date)) + If ( m := Month( date)) <= 3 + eoq := StoD( yyyy + '0331') ElseIf m <= 6 eoq := StoD( yyyy + '0630') + ElseIf m <= 9 + eoq := StoD( yyyy + '0930') Else - eoq := StoD( yyyy + '0331') + eoq := StoD( yyyy + '1231') End Return eoq @@ -318,12 +317,8 @@ Function EOY( date) * $END$ */ Function StoD( cdate) - Local ofd := Set( _SET_DATEFORMAT, 'dd.mm.yyyy'), rvd + Local ofd := Set( _SET_DATEFORMAT, 'dd.mm.yyyy'), rvd cdate := If( ValType( cdate) == 'C', cdate, DtoS( Date())) rvd := CtoD( SubStr( cDate, 7, 2) + '.' + SubStr( cDate, 5, 2) + '.' + SubStr( cDate, 1, 4)) Set( _SET_DATEFORMAT, ofd) Return rvd - - - -