Files
harbour-core/harbour/tests/dates.prg
Viktor Szakats 717adc8afc 2012-07-20 21:30 UTC+0200 Viktor Szakats (vszakats syenar.net)
* contrib/gtwvg/tests/demowvg.prg
  * contrib/gtwvg/tests/wvgwvtclasses.prg
  * contrib/hbct/doc/en/dattime3.txt
  * contrib/hbct/tests/datetime.prg
  * contrib/hbide/ideconsole.prg
  * contrib/hbnf/any2any.prg
  * contrib/xhb/decode.prg
  * doc/en/datetime.txt
  * doc/hdr_tpl.txt
  * examples/gtwvw/tests/cbtest1.prg
  * examples/gtwvw/tests/cbtest6.prg
  * examples/gtwvw/tests/drawimg.prg
  * examples/gtwvw/tests/ebtest7.prg
  * examples/gtwvw/tests/inpfocus.prg
  * examples/gtwvw/tests/maximize.prg
  * examples/gtwvw/tests/wvwmouse.prg
  * examples/gtwvw/tests/wvwtest9.prg
  * examples/hbapollo/tests/test02.prg
  * examples/hbapollo/tests/test09.prg
  * examples/hbapollo/tests/test11.prg
  * examples/hbapollo/tests/test12.prg
  * examples/hbapollo/tests/test13.prg
  * examples/hbapollo/tests/test14.prg
  * examples/hbapollo/tests/test15.prg
  * examples/hbapollo/tests/test20.prg
  * examples/hbapollo/tests/test21.prg
  * examples/hbapollo/tests/test22.prg
  * examples/hbapollo/tests/test23.prg
  * examples/hbapollo/tests/test24.prg
  * examples/hbapollo/tests/test25.prg
  * examples/hbapollo/tests/test26.prg
  * examples/hbapollo/tests/test27.prg
  * examples/hbapollo/tests/test28.prg
  * examples/hbapollo/tests/test29.prg
  * examples/hbapollo/tests/test30.prg
  * examples/hbapollo/tests/test34.prg
  * examples/hbapollo/tests/test35.prg
  * examples/hbapollo/tests/test36.prg
  * examples/hbapollo/tests/test37.prg
  * examples/hbapollo/tests/test38.prg
  * examples/hbapollo/tests/test39.prg
  * examples/hbapollo/tests/test41.prg
  * examples/hbapollo/tests/test42.prg
  * examples/hbapollo/tests/test43.prg
  * examples/hbapollo/tests/test45.prg
  * examples/hbapollo/tests/test46.prg
  * examples/hbapollo/tests/test47.prg
  * examples/hbapollo/tests/test50.prg
  * examples/hbapollo/tests/test51.prg
  * examples/hbapollo/tests/test52.prg
  * examples/hbapollo/tests/test53.prg
  * examples/hbapollo/tests/test54.prg
  * examples/hbapollo/tests/test55.prg
  * examples/hbapollo/tests/test56.prg
  * examples/hbapollo/tests/test57.prg
  * examples/hbapollo/tests/test58.prg
  * examples/hbapollo/tests/test60.prg
  * examples/hbapollo/tests/test61.prg
  * examples/hbapollo/tests/test62.prg
  * examples/hbapollo/tests/test63.prg
  * examples/hbapollo/tests/test64.prg
  * examples/hbapollo/tests/test73.prg
  * examples/hbapollo/tests/test74.prg
  * examples/hbapollo/tests/test75.prg
  * examples/hbapollo/tests/test76.prg
  * examples/hbapollo/tests/test78.prg
  * examples/hbapollo/tests/test82.prg
  * tests/dates.prg
  * tests/usrrdd/exarr.prg
    ! avoid using CTOD() to create dates
    ! avoid setting SET DATE to arbirary formats
    * some formatting
2012-07-20 19:34:56 +00:00

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