FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SetDate() function
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
SetDate() function
Posted: Tue Jan 17, 2006 08:37 PM

Hi

SetDate() function don't work correct, i try:

SetDate(02,01,2006) and returns 01/01/2006

Why?

Thanks.
Fwh2.6

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
SetDate() function
Posted: Wed Jan 18, 2006 08:24 AM
Wanderson,

This sample works ok. Could you please try it ? Thanks.

function Main()

  local dToday := Date() 

  SET DATE FRENCH 

  SetDate( 02, 01, 2006 )

  MsgInfo( Date() )

  SetDate( Day( dToday ), Month( dToday ), Year( dToday ) )

  MsgInfo( Date() )  

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
SetDate() function
Posted: Thu Jan 19, 2006 12:50 AM
Antonio Linares wrote:Wanderson,

This sample works ok. Could you please try it ? Thanks.

function Main()

  local dToday := Date() 

  SET DATE FRENCH 

  SetDate( 02, 01, 2006 )

  MsgInfo( Date() )

  SetDate( Day( dToday ), Month( dToday ), Year( dToday ) )

  MsgInfo( Date() )  

return nil


Antonio don't work for me. This code returns 01/01/2006 and after command SetDate( Day( dToday ), Month( dToday ), Year( dToday ) ) returns 17/01/2006, correct is 18/01/2006. Whats i do rong?
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
SetDate() function
Posted: Thu Jan 19, 2006 02:25 AM
Wanderson,

You should have this code in source\function\datetime.c:

CLIPPER SETDATE( PARAMS )                  // nDay, nMonth, nYear
{
   WORD wYear  = _parni( 3 );
   WORD wMonth = _parni( 2 );
   WORD wDay   = _parni( 1 );

   #ifndef __FLAT__
      _CX = wYear;
      _DH = wMonth;
      _DL = wDay;
      _AH = 0x2B;
      _AL = 0;

      Dos3Call();                     // asm int 0x21;

      _retl( _AL == 0 );
   #else
      SYSTEMTIME st;

      GetSystemTime( &st );
      st.wYear  = wYear;
      st.wMonth = wMonth;
      st.wDay   = wDay;
      _retl( SetSystemTime( &st ) );
   #endif
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
SetDate() function
Posted: Mon Jan 23, 2006 01:28 AM
Antonio Linares wrote:Wanderson,

You should have this code in source\function\datetime.c:

CLIPPER SETDATE( PARAMS )                  // nDay, nMonth, nYear
{
   WORD wYear  = _parni( 3 );
   WORD wMonth = _parni( 2 );
   WORD wDay   = _parni( 1 );

   #ifndef __FLAT__
      _CX = wYear;
      _DH = wMonth;
      _DL = wDay;
      _AH = 0x2B;
      _AL = 0;

      Dos3Call();                     // asm int 0x21;

      _retl( _AL == 0 );
   #else
      SYSTEMTIME st;

      GetSystemTime( &st );
      st.wYear  = wYear;
      st.wMonth = wMonth;
      st.wDay   = wDay;
      _retl( SetSystemTime( &st ) );
   #endif
}


Hi Antonio,

I found the problem.

If i try your example before 11:00 pm runs ok
If i try your example after 11:00 pm returns wrong date.

Thanks.
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
SetDate() function
Posted: Sat Feb 04, 2006 01:10 AM

Antonio,

Dont work setdate() can i send one example to you?

Regards.

Continue the discussion