In App Inventor, there is a component called Clock, which has a block called "FormatDateTime" and its pink pattern has the default text "MM/dd/yyyy hh:mm:ss a" which is editable.
I created a new extension and wanted to simulate this, but in my created block, the pink pattern was not created and the pattern is empty.
My function text is as follows:
// -------------------------------------------------------------
// FORMAT DATE TIME (Calendar + Pattern)
// -------------------------------------------------------------
@SimpleFunction(description = "Returns text representing the date and time of an instant in the specified pattern")
public String FormatDateTime(Calendar instant, String pattern) {
try {
return Dates.FormatDateTime(instant, pattern);
} catch (IllegalArgumentException e) {
throw new YailRuntimeError(
"Invalid pattern for FormatDateTime. Examples: MM/dd/yyyy hh:mm:ss a , MMM d, yyyy HH:mm",
"Format Error");
}
}
Can anyone guide me?

