0

I would like to have a view of the simulation date and time in my view area. I tried to copy the method of the product and delivery example but it didn't work. I did the following:

  • in the simulation experiment properties window I typed the following code in the import java section

            import java.text.SimpleDateFormat;
    
  • in the main view I used the following code in a text block

       new SimpleDateFormat("MMM d, yyyy   HH:mm", Locale.ENGLISH).format( new Date() )
    

The error that I'm getting is: "SimpleDateFormat cannot be resolved to a type".

Does it have to do something with my dependencies? Are dependencies needed?

1 Answers1

1

When you use classes not available by default they need to be imported into the current class.

You can do this in the imports section of the agent you are using the class

enter image description here

But not to worry, had you used code complete it would have been done for you. Simply go to the end of the of SimpleDateFormat code and press code complete (ctr+space on Windows, cmd+space on Mac) and viola, the import section will be updated for you

Jaco-Ben Vosloo
  • 3,770
  • 2
  • 16
  • 33