Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : date$() time$() trailing chars?
Author | Message | ||||
ville56 Regular Member Joined: 08/06/2022 Location: AustriaPosts: 96 |
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: 1245 |
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 Regular Member Joined: 08/06/2022 Location: AustriaPosts: 96 |
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: 339 |
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: 3196 |
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 |
||||
Print this page |