Hi
SetDate() function don't work correct, i try:
SetDate(02,01,2006) and returns 01/01/2006
Why?
Thanks.
Fwh2.6
SetDate() function
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Wanderson,
This sample works ok. Could you please try it ? Thanks.
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?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 Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Wanderson,
You should have this code in source\function\datetime.c:
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,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 }
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.