3

I am trying to find a set of date functions. Looks like the Joda

http://www.joda.org/joda-time/

Does everything I need, but when I call a simple

DateTime dt = new DateTime();

it hangs the Eclipse or Emulator for about 15 seconds.

I must be doing something wrong as I haven't found anyone else complaining about it being slow.

Short of the Joda jar anyone had a datediff() code sample?

JodaStephen
  • 60,927
  • 15
  • 95
  • 117

4 Answers4

2

I can confirm this in version 1, 1.5 and 1.62 ... I got bored after that and instead used Date4J which seems to be working perfectly and meets my needs!

http://www.date4j.net/

Steven Elliott
  • 3,214
  • 5
  • 29
  • 40
0

Is there something wrong with just using the java.util.Date()?

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
0

You can use the Traceview feature, available from the DDMS perspective, to see where the time is going. When you do this, you'll quickly see most of it is initializing the timezone database.

There's more information about some possible workarounds at this other question.

For my application, I knew I would only ever need a few timezones. So, I blanked out the Olson Timezone Database files in the Jodatime source for all the timezones I wasn't using. Then I rebuilt Jodatime.

Community
  • 1
  • 1
Dominic Scheirlinck
  • 2,627
  • 2
  • 23
  • 28
-1

Make sure you are using v1.6.2. There was an Android issue in v1.6 and v1.6.1.

JodaStephen
  • 60,927
  • 15
  • 95
  • 117