Forum Discussion
florentinach
14 years agoOccasional Contributor
Hello,
I need to change only the date on my machine, but not the time. I've tried to use the aqDateTime.SetDateElements/aqDateTime.SetSystemDateTime, but i'm having some problems. Maybe you can help me.
When i'm running the following code in TestComplete the function doesn't set the date or the time correctly. I tried to use the example in the helpfile:
functionSettingNewSystemDateTime()
{
dt1=aqDateTime.SetDateTimeElements(2010, 6, 22, 10, 15, 12);
dt2=aqDateTime.SetDateElements(2010, 6, 22);
time=aqDateTime.SetTimeElements(10, 15, 12);
// Setting new system date
aqDateTime.SetSystemDateTime(dt2);
// Setting new system time
aqDateTime.SetSystemDateTime(time);
// Setting new system date and time
aqDateTime.SetSystemDateTime(dt1);
}
After dt2 is set the date/time shown on my computer is 22June2010 12:00AM.
After time is set the date/time shown on my computer is 9:15AM 12/30/1899.
After dt1 is set the date/time shown on my computer is 11:15AM 6/22/2010
If i'm running this function
functionSettingNewSystemDateTime()
{
dt1=aqDateTime.SetDateTimeElements(2010, 6, 22, 10, 15, 12);
// Setting new system date and time
aqDateTime.SetSystemDateTime(dt1);
}
the time shown on my computer is correct 10:15AM 6/22/2010
Do i need to set something on my machine? What do i do wrong?
Thanks in advance
I need to change only the date on my machine, but not the time. I've tried to use the aqDateTime.SetDateElements/aqDateTime.SetSystemDateTime, but i'm having some problems. Maybe you can help me.
When i'm running the following code in TestComplete the function doesn't set the date or the time correctly. I tried to use the example in the helpfile:
functionSettingNewSystemDateTime()
{
dt1=aqDateTime.SetDateTimeElements(2010, 6, 22, 10, 15, 12);
dt2=aqDateTime.SetDateElements(2010, 6, 22);
time=aqDateTime.SetTimeElements(10, 15, 12);
// Setting new system date
aqDateTime.SetSystemDateTime(dt2);
// Setting new system time
aqDateTime.SetSystemDateTime(time);
// Setting new system date and time
aqDateTime.SetSystemDateTime(dt1);
}
After dt2 is set the date/time shown on my computer is 22June2010 12:00AM.
After time is set the date/time shown on my computer is 9:15AM 12/30/1899.
After dt1 is set the date/time shown on my computer is 11:15AM 6/22/2010
If i'm running this function
functionSettingNewSystemDateTime()
{
dt1=aqDateTime.SetDateTimeElements(2010, 6, 22, 10, 15, 12);
// Setting new system date and time
aqDateTime.SetSystemDateTime(dt1);
}
the time shown on my computer is correct 10:15AM 6/22/2010
Do i need to set something on my machine? What do i do wrong?
Thanks in advance