Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Windows API function sets the system date and time?

Status
Not open for further replies.

nagyf

Programmer
May 9, 2001
74
HU
Consider the case that you have a damaged database but you can import its objects to a new empty one. In case of importing an object its creation date and LastUpdated property are set to the current time. Next day you see all objects having the same creation date (within the duration of the importing process), so you lose the information when you have really modified and created the modules, forms, so on.

How can I retain the creation and modification dates of the database objects when I import them?

Can I set these properties to a past date programatically?

I plan this solution:
1. Read the true system date and time.
In a cycle for each objects to be imported:
2. Read the modifiaction date of the actual object.
3. Set the system date back to the read date.
4. Import the actual object.
Repeat steps #2-4.
5. Reset the system date and time to its true value.

How can I do step #3?
How can I set the system date back to the value read in step#2 programmatically? Is there any Visual Basic object or an API call for date and time setting?

I simplify my question:
Which Windows API function sets the system date and time?
Where can I read about its usage?
TIA



[tt]
Ferenc Nagy
|\ /~ ~~|~~~ nagyf@alpha0.iki.kfki.hu Fax: (36-1)-392-2529 New!
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- 1525 Bp. POB 77. Tel. :(36-1)-392-2550
| \| | `-' ' `-' "The goal of the life is the struggle itself"
[/tt]
 
The GetSystemTime and SetSystemTime in conjucntion with the SYSTEMTIME Data structure should be what you need.

Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top