Skip to main content

[archive] System Date

  • September 2, 2009
  • 9 replies
  • 0 views

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks

9 replies

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
use good old dos :)
DATE

in german its date tt-mm-yy
think that the order in other language could be yy-mm-tt...

here an example:
call "C$SYSTEM" using "date 03-09-09", 97 end-call.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
I used the following code and it failed with a date-status of 5.
Does anyone know what error 5 means?

01 Archive-date pic x(13) value "Date 01-02-09".
01 date-status pic 9 value 0.

call "C$system" using Archive-date, "8"
giving date-status.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
I used the following code and it failed with a date-status of 5.
Does anyone know what error 5 means?

01 Archive-date pic x(13) value "Date 01-02-09".
01 date-status pic 9 value 0.

call "C$system" using Archive-date, "8"
giving date-status.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
I used the following code and it failed with a date-status of 5.
Does anyone know what error 5 means?

01 Archive-date pic x(13) value "Date 01-02-09".
01 date-status pic 9 value 0.

call "C$system" using Archive-date, "8"
giving date-status.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
if this list is correct:
http://heim.ifi.uio.no/~stanisls/helppc/dos_error_codes.html

05 Access denied

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
If this is Windows, you can use the API function SetSystemTime.

Info: http://msdn.microsoft.com/en-us/library/ms724942(VS.85).aspx

The structure in question:

[FONT=Courier New]typedef struct _SYSTEMTIME {[/FONT]
[FONT=Courier New]WORD wYear;[/FONT]
[FONT=Courier New]WORD wMonth;[/FONT]
[FONT=Courier New]WORD wDayOfWeek;[/FONT]
[FONT=Courier New]WORD wDay;[/FONT]
[FONT=Courier New]WORD wHour;[/FONT]
[FONT=Courier New]WORD wMinute;[/FONT]
[FONT=Courier New]WORD wSecond;[/FONT]
[FONT=Courier New]WORD wMilliseconds;[/FONT]
[FONT=Courier New]}SYSTEMTIME, *PSYSTEMTIME;[/FONT]

Can be translated like this:

[FONT=Courier New]01 SYSTEMTIME.[/FONT]
[FONT=Courier New]  03 wYear            PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wMonth           PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wDayOfWeek       PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wDay             PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wHour            PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wMinute          PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wSecond          PIC 9(4) COMP-N.[/FONT]
[FONT=Courier New]  03 wMilliseconds    PIC 9(4) COMP-N.[/FONT]

Use it like this:

[FONT=Courier New]*Load library[/FONT]
[FONT=Courier New]CALL "Kernel32.dll"[/FONT]
[FONT=Courier New]*Set values of SYSTEMTIME group[/FONT]
[FONT=Courier New]*Call function[/FONT]
[FONT=Courier New]CALL "SetSystemTime@WINAPI" USING BY REFERENCE SYSTEMTIME[/FONT]

However, generally speaking, it is not a good idea that applications change the system time. Also do note that with Vista and Windows 7, there are security constraints.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
Thanks for your help.
What I ended up doing was using c$system to run a .bat file with the dos date command in it.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
Thanks for your help.
What I ended up doing was using c$system to run a .bat file with the dos date command in it.

[Migrated content. Thread originally posted on 02 September 2009]

Hello,
Just a quick question:
Is it possible to change the system date programmatically?

Thanks
Thanks for your help.
What I ended up doing was using c$system to run a .bat file with the dos date command in it.