Files
harbour-core/harbour/tests/dates.prg
Viktor Szakats a31023ec0c 2012-11-28 01:06 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbmysql/tmysql.prg
  * contrib/hbnf/doc/en/restsets.txt
  * contrib/hbnf/doc/en/savesets.txt
  * contrib/hbnf/pvid.prg
  * contrib/hbnf/restsets.prg
  * contrib/hbnf/savesets.prg
  * contrib/rddads/tests/testmg.prg
  * contrib/xhb/traceprg.prg
  * contrib/xhb/ttable.prg
  * contrib/xhb/xhberr.prg
  * ChangeLog.txt
  * extras/gtwvw/tests/ebtest7.prg
  * src/debug/debugger.prg
  * tests/dates.prg
  * tests/dates2.prg
  * tests/dates3.prg
  * tests/inherit.prg
  * tests/output.prg
  * tests/readhrb.prg
  * tests/set_num.prg
  * tests/set_test.prg
  * tests/stripem.prg
  * tests/tstcolor.prg
  * website/samples/dates3.prg.html
    % do not #include "set.ch" (it's automatically 
      included via "std.ch")
2012-11-28 00:09:22 +00:00

92 lines
1.8 KiB
Plaintext

/*
* $Id$
*/
// Testing Harbour dates management.
PROCEDURE Main()
LOCAL dDate, dDate2, cMask, cDate
? "Testing Harbour dates management on", Date()
TestCentury()
?
? "dDate := CToD( '02/04/1999' ) =>", dDate := CToD( "02/04/1999" )
? "ValType( dDate ) =", ValType( dDate )
? "Day( dDate ) =", Day( dDate )
? "Month( dDate ) =", Month( dDate )
? "Year( dDate ) =", Year( dDate )
?
? "dDate + 5 =", dDate2 := dDate + 5
? "dDate - 5 =", dDate - 5
?
? "dDate2 - dDate =", dDate2 - dDate
?
? dDate, DToS( dDate )
? "19990429", hb_SToD( "19990429" )
?
Set( _SET_EPOCH, 1950 )
cMask := "dd/mm/yyyy"
cDate := "02/04/49"
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
cMask := "mm/dd/yyyy"
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
cMask := "yyyy/mm/dd"
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
? "49/02/04", cMask, CToD( "49/02/04" )
TestCentury()
?
cMask := "yyyy/dd/mm"
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
?
? "49/02/04", cMask, CToD( "49/02/04" )
?
cMask := "ddd/mmm/yy"
Set( _SET_DATEFORMAT, cMask )
dDate := CToD( cDate )
? cDate, cMask, dDate, DToS( dDate ), DToC( dDate )
RETURN
PROCEDURE TestCentury()
?
? __SetCentury()
__SetCentury( "ON" )
?? __SetCentury()
__SetCentury( "OFF" )
?? __SetCentury()
__SetCentury( "GIBBERISH" )
?? __SetCentury()
__SetCentury( .T. )
?? __SetCentury()
__SetCentury( 5 )
?? __SetCentury()
RETURN