PDA

View Full Version : Travail avec les dates


Raphaël
10-02-2007, 06:05 PM
Bonjour,
Je suis sans doute stupide ! Mais je ne sais pas comment additionner ou soustraire des dates ou des heures.
Si vous pouvez m'aider merci.

kornalius
10-02-2007, 07:12 PM
Bonjour, vous allez devoir utiliser les fonctions du Windows API.

http://msdn2.microsoft.com/en-us/library/ms725473.aspx

struct(st$, SYSTEMTIME);
struct(ft$, FILETIME);

GetSystemTime(&st$);
SystemTimeToFileTime(st$, ft$);

nano100SecInDay$ = 10000000 * 60 * 60 * 24;

// The trick is to convert a filetime type to integer type so you can add the number of days and convert it back to filetime.

d$ = int64(ft$);
toint64(&ft$, d$ + nano100SecInDay$ * 15); // Adds 15 days to filetime.

Here is a good start:

http://www.codeproject.com/datetime/winapi_datetime_ops.asp

The In64() and ToInt64() functions will be new to version 1.32. Expect this code to work in version 1.32 and up.

kornalius
10-02-2007, 07:15 PM
Je m'excuses la dernière ligne veux dire:

Les fonctions Int64() et ToInt64() seront disponibles dans la version 1.32.

Raphaël
10-03-2007, 10:05 AM
Merci.