No announcement yet.

Setting Date and Time By Program

  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting Date and Time By Program

    I have a question. The Date$ and Time$ functions can return the current date and time.
    while the Date$ and Time$ statements can set them.

    But I've got someone trying to tell me that a "modern" Operating System will not support
    the Date$ and Time$ statements. I know that they work in Win2K/XP, so I wonder what he's referring to. Probably Vista, but I'm trying to figure out what other OS he is thinking about. I would like to be able to respond with some specifics if I can.

  • #2
    He may be thinking of Dos Date and Time.

    DATE$ and TIME$ work quite well in VISTA(within PB of course)

    Find out what it is that has taken the place of DATE$ and TIME$.

    If he tells you GetSystemTime and SetSystemTime then he's referring to the appropriate SDK functions.

    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.


    • #3
      It's a "privileges thing"!
      Check this with Google: SetSystemTime Vista

      -- The universe tends toward maximum irony. Don't push it.

      File Extension Seeker - Metasearch engine for file extensions / file types
      Online TrID file identifier | TrIDLib - Identify thousands of file formats


      • #4
        on our workstations in windows 2000 and same would be for versions after, our computers are run in accounts setup under user mode only. the user cannot change the date or the time. if the administrator can set the coputers date and time or you could set it up in the bios, bad idea, i always use the wrong year for up to two months in the new year-January and February.
        the solution to the problem is have the windows os run the windows time service found by running services.msc while in administrator mode and set the windows os to automatically retrieve and set the date and time by using the "net time" commands at the command prompt.
        i believe some of the newer versions have a gui way of setting this under date/time from the control panel.
        i learned many years ago how important it was to have the correct date and time set while running any os, and i keep this motto today.
        if any software allows you to change a computer's date and time, not just the date or time inside the program being ran for the programs sole purpose, that tells me it is bad design from the programmers perspective and the program should be avoided and possibly the programmer if programmer does not understand the value of keeping a os's date and time to the correct values.

        now when the user boots or logs into the windows computer, windows will get the date and time from a timer server, best to do a reboot after making the above change.
        i also will change the time to values of 7 hours back on the same day to see if the time gets update correctly.
        also, it is wise to double check your times with a second time source, maybe a server or time service.
        i had one office years ago on a mpm system do all contracts with the dates off one year, do not be that person.
        the computers had no battery and sooner or later, your battery will also fail in your computer, and if you only lose the date and time you are fortunate, but i immediate wrote a program that would allow you set the date only to the last booted date, back on day, or forward one day, or with a range of friday to monday skipping weekend days.

        Last edited by Paul Purvis; 28 May 2008, 12:45 AM.
        p purvis


        • #5
          He could be refering to the fact that they are just a static value not adjusting for Timezones or DST, etc.
          Mobile Solutions
          Sys Analyst and Development