+ contrib/hbct/tests/dates4.prg
- tests/dates4.prg
* contrib/hbnf/byt2bit.prg
* contrib/hbnf/dectobin.prg
* contrib/hbnf/popadder.prg
* tests/ac_test2.prg
* tests/ainstest.prg
* tests/and_or.prg
* tests/array16.prg
* tests/arrays.prg
* tests/begin.prg
* tests/byref.prg
* tests/calling.prg
* tests/clasinh.prg
* tests/clasinit.prg
* tests/classes.prg
* tests/clsnv.prg
* tests/codebloc.prg
* tests/dates.prg
* tests/debugtst.prg
* tests/destruct.prg
* tests/dirtest.prg
* tests/dynobj.prg
* tests/exittest.prg
* tests/fib.prg
* tests/files.prg
* tests/fornext.prg
* tests/fsplit.prg
* tests/gtchars.prg
* tests/ifelse.prg
* tests/inherit.prg
* tests/inifiles.prg
* tests/initexit.prg
* tests/inkeytst.prg
* tests/inline.prg
* tests/iotest.prg
* tests/iotest2.prg
* tests/longdev.prg
* tests/longstr2.prg
* tests/memvar.prg
* tests/multiarg.prg
* tests/newrdd.prg
* tests/nums.prg
* tests/objasign.prg
* tests/objects.prg
* tests/overload.prg
* tests/passref.prg
* tests/procname.prg
* tests/readhrb.prg
* tests/returns.prg
* tests/rto_get.prg
* tests/rto_tb.prg
* tests/sbartest.prg
* tests/setkeys.prg
* tests/speed.prg
* tests/statfun.prg
* tests/statics.prg
* tests/stripem.prg
* tests/switch.prg
* tests/tb1.prg
* tests/test_all.prg
* tests/testbrw.prg
* tests/testcls.prg
* tests/testerro.prg
* tests/testfor.prg
* tests/testmem.prg
* tests/testntx.prg
* tests/testop.prg
* tests/testpp.prg
* tests/testrdd2.prg
* tests/teststr.prg
* tests/testvars.prg
* tests/testwarn.prg
* tests/tstasort.prg
* tests/tstdbi.prg
* tests/tstmacro.prg
* tests/varparam.prg
* tests/vidtest.prg
* various cleanups, fixes and formatting
now most tests are warning and error free
92 lines
2.4 KiB
Plaintext
92 lines
2.4 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
// Testing Harbour dates management.
|
|
|
|
#include "set.ch"
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL dDate, dDate2, cMask, cDate
|
|
|
|
OutStd( hb_eol(), "Testing Harbour dates management on", Date() )
|
|
|
|
TestCentury()
|
|
|
|
OutStd( hb_eol(), "" )
|
|
OutStd( hb_eol(), "dDate := CToD( '02/04/1999' ) =>", dDate := CToD( "02/04/1999" ) )
|
|
|
|
OutStd( hb_eol(), "ValType( dDate ) =", ValType( dDate ) )
|
|
|
|
OutStd( hb_eol(), "Day( dDate ) =", Day( dDate ) )
|
|
OutStd( hb_eol(), "Month( dDate ) =", Month( dDate ) )
|
|
OutStd( hb_eol(), "Year( dDate ) =", Year( dDate ), hb_eol() )
|
|
|
|
OutStd( hb_eol(), "dDate + 5 =", dDate2 := dDate + 5 )
|
|
OutStd( hb_eol(), "dDate - 5 =", dDate - 5, hb_eol() )
|
|
|
|
OutStd( hb_eol(), "dDate2 - dDate =", dDate2 - dDate )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
OutStd( hb_eol(), dDate, DToS( dDate ) )
|
|
|
|
OutStd( hb_eol(), "19990429", SToD( "19990429" ) )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
SET( _SET_EPOCH, 1950 )
|
|
cMask := "dd/mm/yyyy"
|
|
cDate := "02/04/49"
|
|
SET( _SET_DATEFORMAT, cMask )
|
|
dDate := CToD( cDate )
|
|
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
cMask := "mm/dd/yyyy"
|
|
SET( _SET_DATEFORMAT, cMask )
|
|
dDate := CToD( cDate )
|
|
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
cMask := "yyyy/mm/dd"
|
|
SET( _SET_DATEFORMAT, cMask )
|
|
dDate := CToD( cDate )
|
|
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
|
|
OutStd( hb_eol(), "" )
|
|
OutStd( hb_eol(), "49/02/04", cMask, CToD( "49/02/04" ) )
|
|
|
|
TestCentury( hb_eol() )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
cMask := "yyyy/dd/mm"
|
|
SET( _SET_DATEFORMAT, cMask )
|
|
dDate := CToD( cDate )
|
|
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
|
|
OutStd( hb_eol(), "" )
|
|
OutStd( hb_eol(), "49/02/04", cMask, CToD( "49/02/04" ) )
|
|
|
|
OutStd( hb_eol(), "" )
|
|
cMask := "ddd/mmm/yy"
|
|
SET( _SET_DATEFORMAT, cMask )
|
|
dDate := CToD( cDate )
|
|
OutStd( hb_eol(), cDate, cMask, dDate, DToS( dDate ), DToC( dDate ) )
|
|
|
|
RETURN
|
|
|
|
PROCEDURE TestCentury()
|
|
|
|
OutStd( hb_eol(), "" )
|
|
OutStd( hb_eol(), __SetCentury() )
|
|
__SetCentury( "ON" )
|
|
OutStd( __SetCentury() )
|
|
__SetCentury( "OFF" )
|
|
OutStd( __SetCentury() )
|
|
__SetCentury( "GIBBERISH" )
|
|
OutStd( __SetCentury() )
|
|
__SetCentury( .T. )
|
|
OutStd( __SetCentury() )
|
|
__SetCentury( 5 )
|
|
OutStd( __SetCentury() )
|
|
|
|
RETURN
|