How to change pattern or format of time

Hello everyone,
I am trying to change format of time but its not working. Please help!

My time is stored in string in pattern of Year/Month/Date HH:MM:SS
And I want to convert in MM/dd/yyyy hh:mm:ss
My blocks are-
blocks
But its showing error, suggest me right method.
Thank You

Try to replace the “instant” section. See pricture. Then it should work.
grafik

Regards,

Leon

2 Likes

Thank you @schnleon but I’m taking time from timedb server so i cannot replace that block, any more suggestions?

So the “Timedb” has a different time than the user?

EDIT: if it is the same time then do it like this. You can change the pattern as you like.

Hi
Don’t store time in any format.
When you are saving to TinyDB, just save the entire instance (Clock1.Now should be value of TinyDB.store)
You can then use that instance and format it to the type you want.

1 Like

No it’s not the same time, because i wanted universal time so i fetch it from internet! And it’s in string, i think that’s why its not working.

The call “clock”.Now method returns a “Calendar” and not a string.
Calendar = java.util.Calendar;

So you can not us a string as instant.

3 Likes