Page 1 of 1

SetDate() function

Posted: Tue Jan 17, 2006 8:37 pm
by Wanderson
Hi

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

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

Why?

Thanks.
Fwh2.6

Posted: Wed Jan 18, 2006 8:24 am
by Antonio Linares
Wanderson,

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

Code: Select all

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

Posted: Thu Jan 19, 2006 12:50 am
by Wanderson
Antonio Linares wrote:Wanderson,

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

Code: Select all

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?

Posted: Thu Jan 19, 2006 2:25 am
by Antonio Linares
Wanderson,

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

Code: Select all

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
}

Posted: Mon Jan 23, 2006 1:28 am
by Wanderson
Antonio Linares wrote:Wanderson,

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

Code: Select all

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.

Posted: Sat Feb 04, 2006 1:10 am
by Wanderson
Antonio,

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

Regards.