Import in script step

I can't import java.util.Date, why?

asked 13.03.2017 at 08:13

Alex%20Suter's gravatar image

Alex Suter ♦♦
accept rate: 82%

The reason is, that already a date class is provided in the ivy script environement. If you import another date class, there will be an error: "The import java.util.Date collides with Date".

We provide some utility classes from the package ch.ivyteam.ivy.scripting.objects like Date, Time, DateTime which should be more intuitive to use than the regulary java classes from the jdk like java.util.Date.

You can still use java.util.Date But you need to address the class with the fully qualified name. Like: java.util.Date date = new java.util.Date();. As you can think, some APIs requires java.util.Date as parameter and therefore its needed.


answered 13.03.2017 at 08:24

Alex%20Suter's gravatar image

Alex Suter ♦♦
accept rate: 82%

edited 05.04.2017 at 10:00

it is best to use the java 8 Date api


answered 06.04.2017 at 17:23

Stelt0's gravatar image

accept rate: 12%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 13.03.2017 at 08:13

Seen: 1,736 times

Last updated: 06.04.2017 at 17:23