How can i convert Formatdata (MMM d, yyyy) to instant....?

for example i want to know instant value of "06/05/2023"

Here's one way ...

But isn't MMM an alphabetic month format, like 'May' ?

M	Month in year	Month	July; Jul; 07

from SimpleDateFormat (Java Platform SE 7 )

what i want is to add day on my day value with "MMM d, yyyy" from.

but i can't......why this block dosen't work...?

Not separetly, i want to have an instant value of MMM d,yyyy form


When a block wants to eat an Instant, give it an Instant.

welcome to my point! MMM d, yyyy already saved on my database and had MMM d, yyyy so how can i add day on it.

Are you sure it's saved internally to the database as MMM d, yyyy, and not a case of the database deciding to format it on the way out of the database?

What kind of database?

i save the data on tinydb by converting instant value of date picker to MMM d, yyyy.
as example like this..

then, i want to add day on it after i retriving date value from tinydb.
how could it be?

You are making unnecessary work for yourself (and us) when you format dates on their way into TinyDB.

Dates should only be formatted on their way out into a user display, where they don't need to feed further calculation.

I like the Milliseconds From 1970 numerical value for my internal date/time values, since you can do date math on the numbers directly using math blocks.

Look through the Clock blocks for its many conversion blocks.

show me 1 example about how to save date to databese in millisecondform please....

and please tell me the possible way to add day on MMM d, yyyy form.

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See A way to group projects by theme - #10 by ABG
for a demo.

1 Like

It's easier to talk you into storing dates right than to try to convert dates back into Instants or Milliseconds from text MMM d,yyyy form.

Bad arguments to GetMillis

the opration GetMilli cannot accept : , [May 23, 2023]
the error is this when i am retriving date from database to convert it in ti millisecound...what dose it mean...

Bad arguments to GetMillis

the opration GetMilli cannot accept : , [May 23, 2023]
the error is this when i am retriving date from database by specifing its index in the list ,to convert it in ti millisecound...what dose it mean...?

Maybe it's time for you to see what an Instant looks like.
Assign an Instant into a Label.Text
Also, hover your cursor over the GetMillis block in the Blocks Editor to see its Tool Tip.

GetMilli is very limited in what it can accept.

If you want to turn May 23, 2023 into an Instant you have to:

  • separate out the May in the first 3 letters
  • Look up May in a list of months (Jan, Feb, Mar,...) and get its position in the list for a month number
  • pick out the 23 from the text date
  • pick out the 2023 from the text date
  • Feed all 3 numbers into the Clock block that can make an Instant from it.

I'll wait here while you do that.

1 Like

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