Announcement

Collapse
No announcement yet.

Changing Date and Time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing Date and Time

    Whenever I try to change the date within a program to update the computer
    date and time, I get the message "illegal function"
    The code I wrote will allow me to change the date and time, but when the date and time are null, I get the "illegal function" error.
    How can I change the computer date and time within a program without closing the program and entering dos to do it?.
    Thanks.

  • #2
    As described in the online-help, use the built-in DATE$ system variable:
    Code:
    a$ = "01-01-2000" ' mm-dd-yyyy
    DATE$ = a$
    PRINT DATE$
    Time is set in the same manner:
    Code:
    a$ = "10:42:00" ' hh:mm:ss
    TIME$ = a$

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      You can set the date with INT 21h, function 2Bh and set the time with INT 21h, function 2Dh. Use of these Interrupt functions avoids any Illegal Function Call errors, and also abrogates the need to deal with that annoying American date format.

      [This message has been edited by Matthew Berg (edited February 04, 2000).]
      If you try to make something idiot-proof, someone will invent a better idiot.

      Comment

      Working...
      X