SetDate() function

SetDate() function

Postby Wanderson » Tue Jan 17, 2006 8:37 pm

Hi

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

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

Why?

Thanks.
Fwh2.6
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Postby Antonio Linares » Wed Jan 18, 2006 8:24 am

Wanderson,

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

Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Wanderson » Thu Jan 19, 2006 12:50 am

Antonio Linares wrote:Wanderson,

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

Code: Select all  Expand view  RUN
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?
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Postby Antonio Linares » Thu Jan 19, 2006 2:25 am

Wanderson,

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

Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Wanderson » Mon Jan 23, 2006 1:28 am

Antonio Linares wrote:Wanderson,

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

Code: Select all  Expand view  RUN
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.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Postby Wanderson » Sat Feb 04, 2006 1:10 am

Antonio,

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

Regards.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests