Hi experts, I have a question. Is it possible to set (change/edit) the system time and date by coding in vb6.0? I think it's not possible (80%) but maybe experts might have an answer - I suppose.
Setting System Time and Date from VB6.0
Collapse
X
-
I could not find a way from vb 6 however there is a way using vb 2005.Originally posted by vdraceilHi experts, I have a question. Is it possible to set (change/edit) the system time and date by coding in vb6.0? I think it's not possible (80%) but maybe experts might have an answer - I suppose.
Visual Basic 2005
Visual Basic 2005 replaces Date and Time with the Today and TimeOfDay properties, which use the eight-byte common language runtime (CLR) DateTime structure. This corresponds with the Date data type in Visual Basic 2005. You can use Today and TimeOfDay to both set and fetch the system date and time.
Visual Basic 2005 replaces the Date$ and Time$ functions with the DateString and TimeString properties. You can use DateString and TimeString to both set and fetch the system date and time.
The Now and Timer functions are replaced by read-only properties of the same names. Their calling sequences remain unchanged.
Merry Christmas -
Originally posted by vdraceilHi experts, I have a question. Is it possible to set (change/edit) the system time and date by coding in vb6.0? I think it's not possible (80%) but maybe experts might have an answer - I suppose.
Hi,
Date = CDate("29-12-2007")
Regards
VeenaComment
-
Only if you configure them that way.Originally posted by TorggIf memory serves, Windows XP (SP2) and Vista systems update their date and time from the internet every few days.
In fact, I don't think XP has that built in at all, does it? Don't you have to download synchronisation software from somewhere? Or am I think of an earlier version of Windows?Comment
-
That's right. The CDate function in that code was simply converting the string to a date value.Originally posted by vdraceilThanks for replying..
Isn't CDate() a conversion type function like CInt,CSng etc..Will it set system time?! Please clear my doubt..
I have no idea whether it works or not, but assigning the value to Date must be what was intended to do the job.Comment
-
So we dont have a possibility of setting time by code in vb6.0 ?!Originally posted by Killer42That's right. The CDate function in that code was simply converting the string to a date value.
I have no idea whether it works or not, but assigning the value to Date must be what was intended to do the job.Comment
-
HiOriginally posted by vdraceilSo we dont have a possibility of setting time by code in vb6.0 ?!
If you want to modify the current system date and time you can try this:
[CODE=vb] Shell "rundll32.e xe shell32.dll,Con trol_RunDLL timedate.cpl,,0 "
[/CODE]
Rey SeanComment
-
From VB6 Help...
Date Statement
Sets the current system date.
Syntax
Date = date
For systems running Microsoft Windows 95, the required date specification must be a date from January 1, 1980 through December 31, 2099. For systems running Microsoft Windows NT, date must be a date from January 1, 1980 through December 31, 2079.Comment
Comment