Save date to TINYDB and calculate days

I need to save a date in tinyDB, and days later I need to count the number of days that have passed since the stored date. Can you help me, thanks

What have you tried and did you search the community. Almost all questions are asked before.

2 Likes

I tried to find something related, but I didn’t.

The topic you sent me doesn’t help me, because the old date is in TINYDB

You will not always get the exact blocks related to your query. The blocks provided in Peter’s quoted reply is almost similar to what you want, just need to change one or two blocks there which I guess you should take it as a task :wink:

2 Likes

Yes, I understand, but I didn’t find anything related to TINYDB. I’ll keep searching, thanks

convert it into millis before saving, after reading then convert it back

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

Try this one

Update:
This block working fine and tested,

Save date to TinyDB and calculate the days

as you asked.

I have used both event same but you can split into according to your needs.
my suggestion, Instead of saving the date in tinyDB store it in firebaseDB and retrieve the work out

Note: Even if you store the values in DDMMYYYY clock will calculate it by assuming MMDDYYYY so work out based on this.

If you are satisfied mark solution if not tell us, People will help you

1 Like

Oops, cool, but I would like to use the DATE PICKER, you can. Choose the date and save it to the database.

But it already gave me a light, I am going to study this example and also the other one that the colleague went through. Thanks

I’m doing some tests, also studying the examples that were given here.

Yes , you blocks are also sound good. But we have answered according to his incomplete question… there is lot of doubts are there in his method but no issue for that. We have showed him the simplest way to store the date and calculate the number of days

I’m buying bitcoin, for an old lady and she doesn’t understand it very well, I’m trying to simplify it for her.

It turns out that the amount of days passed, as you can see on the screen is not hitting yet, but I am getting close thanks to the help of youis.

As I said earlier, you stored the date in DDMMYYYY format but clock will calculate the number of days in MMDDYYYY. change it to default format and try

If not even you will get the number of days in negative value too.

That 218 is because of this calculation

TinyDB stored date value is,
MM=7 DD=12 YYYY=2020

Call now format is,
DD=14 MM=2 YYYY=2021

So the total no of days is 218

I hope you understand the logic

Problem solved, I made the changes. But one question, is there a way to get the value of BITCOIN to bring to the text box, when starting?

So maybe share the end result for others to learn from. That is the purpose of a community.

ya, it is possible with api key feature

You deleted the solution, Any problem with that explanation? If possible click on solution there by it will be helpful to others

No, it is selected. thanks.
where can i get API?

1 Like

#off-topic

You can create it as another topic

better visit here, https://api.coindesk.com/v1/bpi/currentprice.json

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.