Import java.uti.date 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 ♦♦
3.1k122247
accept rate: 84%


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.

link

answered 13.03.2017 at 08:24

Alex%20Suter's gravatar image

Alex Suter ♦♦
3.1k122247
accept rate: 84%

edited 05.04.2017 at 10:00

it is best to use the java 8 Date api

link

answered 06.04.2017 at 17:23

Stelt0's gravatar image

Stelt0
(suspended)
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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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

Tags:

×33

Asked: 13.03.2017 at 08:13

Seen: 4,053 times

Last updated: 06.04.2017 at 17:23