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-
But its showing error, suggest me right method.
Thank You
schnleon
(Leon )
October 11, 2018, 9:39am
#2
Try to replace the “instant” section. See pricture. Then it should work.
Regards,
Leon
2 Likes
Thank you @schnleon but I’m taking time from timedb server so i cannot replace that block, any more suggestions?
schnleon
(Leon )
October 11, 2018, 9:54am
#4
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.
Vishwas
(Vishwas Adiga)
October 11, 2018, 9:54am
#5
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.
Mika
October 11, 2018, 11:00am
#7
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