|
Forum Index : Microcontroller and PC projects : date$() time$() trailing chars?
| Author | Message | ||||
| ville56 Senior Member Joined: 08/06/2022 Location: AustriaPosts: 290 |
Hi, just encountered trailing chars in date$() and time$() functions. E.g. print time$(now) returns "19:28:07 0" and print date$(now) returns "17-03-21 0" datetime$ seems to be not affected. This bug(?) applies to Pico and PicoWeb, both latest versions. Reagrds, Gerald 73 de OE1HGA, Gerald |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1682 |
Hi Gerald, I think "now" is interpreted as a regular variable. I.e. you get the result of Date$ plus the variable "now", which in your case is "0". Try your entries after "Option explicit". Edited 2023-03-18 05:03 by twofingers causality ≠ correlation ≠ coincidence |
||||
| ville56 Senior Member Joined: 08/06/2022 Location: AustriaPosts: 290 |
thanks twofingers, you are absolutely right. Overlooked that there are no arguments with that functions. Retrospectively I would have expected a syntax error, but be it as it is. tnx agn, Gerald 73 de OE1HGA, Gerald |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 490 |
When someone asked Yogi Berra*, "Yogi, what time is it?" He answered, "You mean now?" * Yogi was an American baseball player known for his offbeat speech |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
This illustrates one of the problems with parsing expressions. Date$ is a valid function that returns the date. (now) is a perfectly OK (if odd) expression which resolves to the variable now which defaults to zero. Put the two together and you have a completely correct BASIC expression which does not do what you expected. Geoff Geoff Graham - http://geoffg.net |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |