Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:57 15 Sep 2026 Privacy Policy
Jump to

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
Guru

Joined: 08/06/2022
Location: Austria
Posts: 600
Posted: 06:34pm 17 Mar 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 1769
Posted: 06:58pm 17 Mar 2023
Copy link to clipboard 
Print this post

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
‚My name is Ozymandias, king of kings
Look on my works, ye Mighty, and despair!‘
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and ...
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 600
Posted: 07:14pm 17 Mar 2023
Copy link to clipboard 
Print this post

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 States
Posts: 720
Posted: 04:04am 18 Mar 2023
Copy link to clipboard 
Print this post

  ville56 said  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


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: Australia
Posts: 3368
Posted: 08:07am 18 Mar 2023
Copy link to clipboard 
Print this post

  ville56 said  Retrospectively I would have expected a syntax error

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


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026