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: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- 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 | Expand
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 wrote:Wanderson,
This sample works ok. Could you please try it ? Thanks.Code: Select all | Expand
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
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- 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 | Expand
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
}
Antonio Linares wrote:Wanderson,
You should have this code in source\function\datetime.c:Code: Select all | Expand
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.