Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:13 13 Jul 2025 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 : datetime$ error on picomite

Author Message
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 04:06am 26 Jan 2022
Copy link to clipboard 
Print this post

This works as per the User Manual
> ? datetime$(now)
25-01-2022 10:53:50

But if I try a number instead of now, I get
> ?datetime$(0)
Error : 0 is invalid (valid is -2147483648 to 2147483647)

when I should get (as I read the manual)
01-01-1970 00:00:00

All other numbers do the same.  Am I misreading the manual?  I tried to do a search on datetime$ but couldn't find a forum entry.

Thanks, k2
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1114
Posted: 04:35am 26 Jan 2022
Copy link to clipboard 
Print this post

@k2backhoe

Peter may elaborate but I suspect that now is an internal function to return the current date and time in a format that epoch and datetime$ can use. Ie. it is not a variable available to users.

I think if you wish to set the date and time to specific values, you will have to use the date$ and time$ commands
eg.
date$ = "01-01-1970"
print date$(now)
gives
01-01-1970 0

I have no idea where the trailing 0 comes from - I suspect it is a bug?

Doug.

Edit: On reflection, the trailing 0 I believe is the other part of the 'now' internal component. I used the example of just date$ above so the time component of 'now' was not needed by date$ hence the '0'.

The short answer to this is 'don't use now in date$ or time$, just datetime$ or epoch'. D.
Edited 2022-01-26 14:40 by panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2613
Posted: 05:21am 26 Jan 2022
Copy link to clipboard 
Print this post

k2backhoe has identified an omission in datetime$. The error message suggests (as per the manual) that it is trying to process an epoch number but failing.

some results are:-

> date$="26-01-2022"
> time$="16:12"
> ? date$, time$
26-01-2022      16:12:29
> ? DATETIME$(now)
26-01-2022 16:13:31
> ? DATETIME$(epoch(now))
Error : 1643213634 is invalid (valid is -2147483648 to 2147483647)
> ? epoch(now)
1643213683
> ? epoch(DATETIME$(now))
1643213743
> ? epoch("26-01-2022 16:13:31")
1643213611
>
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10247
Posted: 07:58am 26 Jan 2022
Copy link to clipboard 
Print this post

I found/fixed the bug when testing the windows version will retrofit to the PicoMite in next release
 
k2backhoe
Regular Member

Joined: 04/12/2021
Location: United States
Posts: 47
Posted: 03:14pm 26 Jan 2022
Copy link to clipboard 
Print this post

matherp and phill99, thanks so much for the prompt and comprehensive replies.  I can work around this without a problem until the next release.  
PS. I love picomite basic, it is an excellent language that does exactly what I need to do.  Thanks for it.
 
VK2XG
Newbie

Joined: 27/01/2022
Location: Australia
Posts: 3
Posted: 12:29am 30 Jan 2022
Copy link to clipboard 
Print this post

Likewise Thanks.
And sorry for adding a new post on this subject.
Looking foward to the next Picomite version.
 
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 2025