DATE$ function - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: DATE$ function (/showthread.php?tid=2060) |
DATE$ function - eoredson - 10-04-2023 I noticed the Date$ function returns the current date, but there is no: Code: (Select All) Print "Date"; I would like to be able to set the system date. Erik. RE: DATE$ function - mnrvovrfc - 10-04-2023 (10-04-2023, 05:31 AM)eoredson Wrote: I would like to be able to set the system date. It's not allowed on Linux, nor set the `TIME$` from QB64. It would require temporary superuser permission. I guess the command versions were a trick that worked very well on 16-bit computers running GW-BASIC or BASICA. But it became dangerous to allow the user to change the date and time from a program. Even though Windows10 and earlier never resisted the user setting the time completely wrong. Probably Windows11 has become line Linux. Some operating systems don't handle time zone correctly. They don't allow NTP sync which is otherwise a solution for improperly setting the time according to time zone related to UTC. On one distro I have to run a separate program for NTP sync because, for some reason, the GUI system settings for that operating system keeps the whole dialog greyed out. I cannot even manually set the date and time. I noticed something else, LOL you're trying to use `INPUT` to obtain a date! You will have to check the input rigidly. There are a wide variety of date formats. What if the user wants to type in a day of the week, but it's wrong for the given date? "Tuesday October 4 2023"? It could be dangerous to accept that. (Today is Wednesday.) If you look at the help for `strftime()` function in C, you would notice there are mind-boggling combinations of displaying items from the date, time or time zone. RE: DATE$ function - SpriggsySpriggs - 10-04-2023 If you want to set the system date, I recommend clicking the date in the bottom right corner of your monitor and changing it through the popup. In Control Panel, this requires administrator privileges. In Windows' new Settings menu, this can be done without those rights and does the exact same thing. Changing the date and time through some program would be a bad idea, as mnrvovrfc (is that just some random letter combination?) said. RE: DATE$ function - SMcNeill - 10-04-2023 (10-04-2023, 11:19 AM)SpriggsySpriggs Wrote: If you want to set the system date, I recommend clicking the date in the bottom right corner of your monitor and changing it through the popup. In Control Panel, this requires administrator privileges. In Windows' new Settings menu, this can be done without those rights and does the exact same thing. Changing the date and time through some program would be a bad idea, as mnrvovrfc (is that just some random letter combination?) said. Isn't it: men are vov-riffic? (mn r vov rfc) The vov is symbolic... leave your elbows down, raise your hands up and out to the side, and make a piteous face like you're surrendering or clueless. At least, that's the interpretation I take away from it. Did I win? Was I right?? Men are shrug-riffic? RE: DATE$ function - TempodiBasic - 10-04-2023 @eoredson the strange matter is that parser lets you type "Date$ = "something" OR "Date$= MyString$" without a warning or an error alert! As Wiki shows Date$ is a function that returns a string value... it cannot be used as a string variable to initialize! Date$ wiki RE: DATE$ function - bplus - 10-04-2023 (10-04-2023, 05:04 PM)TempodiBasic Wrote: @eoredson He's stuck in the past and wants to do all you coulda done with old QB. You use to be able to set date as he has shown. Hey Eric does it work from a .bat file? RE: DATE$ function - RhoSigma - 10-04-2023 (10-04-2023, 05:34 PM)bplus Wrote:(10-04-2023, 05:04 PM)TempodiBasic Wrote: @eoredson Also this Unsupported keywords Wiki page states alraedy in the first few lines why it don't give an error. Clear advantage for people who are willing to look around by themself instead of complaining over and over. RE: DATE$ function - Kernelpanic - 10-04-2023 Quote:Also this Unsupported keywords Wiki page states alraedy in the first few lines why it don't give an error.DATE$ (statement) The statement is not supported. And I was wondering why this doesn't work, i.e. the date isn't changed. Code: (Select All)
RE: DATE$ function - eoredson - 10-04-2023 I tried the following code with no result: Code: (Select All) ' some code to attempt to change the system date. RE: DATE$ function - SMcNeill - 10-04-2023 Did you try "Run as admin"? Windows really doesn't want folks to do much tinkering on date and time anymore, as they like to sync things all nice and neat via the web. I honestly can't think of the last time that I've ever had to manually set the date and time on any of my PCs. |