Clock1.FormatDateTime.instant not accepting clock1.systemtime block any more

I have used clock.formatDateTime blocks to generate current Date and Time variables in an APP.
Those components have stopped working for me.
I cannot attach the clock1.systemtime block to the instant block of the clock1.FormatDateTime block anymore.


In the image, I copied P81_01_the_date function, but the copy won't accept the systemTime

A possible solution is the use of the Clock1 component "Clock1.now" instead of the "clock1.systemTime".
I am trying this out now :slight_smile:

Not tested but you could try:

image

This was actually a bug in the blocks editor previously. It allowed for connecting these two blocks because the type of the SystemTime method was wrong in the blocks. In reality, this block returns a long, which is not an Instant (java.util.Calendar on Android or NSDate on iOS), but was typed for the latter. The right thing to do is pass this through MakeInstantFromMillis to convert the system time into an Instant object for use in FormatDateTime.

1 Like

"Clock1.Now" is working for me, but maybe that has the wrong definiton as well?
should I change it to clock1.FormatDateTime.instant=MakeInstantFromMillis(clock1.SytemTime)?

There must be thousands of Projects using **.**Now (the device clock time), and since it is currently working in nb188, it should be fine David.

1 Like

Clock.Now() does return an Instant object, not the time in millis, so you should be fine there.

3 Likes

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