Questions tagged [time4j]

Concerns questions directly related to the alternative date, time and interval library Time4J.

Its API can be either used as enhancement for missing features centered around time and calendars or as replacement of java.time-package on Java-8. There is also a backport available when running on platforms Java-6+7 (using version line v3.x).

The design is mainly orientated towards:

  • thread-safety (immutability)
  • good internationalization (own resources based on CLDR-data)
  • accurate modelling of alternative calendars, historic dates, leap-seconds etc
  • easy conversion and interoperability with java.time-classes
  • extensive interval handling

The source code and issue tracker can be found on GitHub. The API and tutorial are available online under: time4j.net

A sister project named Time4A is very similar but designed for the usage on the Android platform.

26 questions
1
vote
1 answer

Iterating recurring timestamps for a given range in Time4j

I am using Time4j to parse recurring intervals like this: IsoRecurrence.parseTimestampIntervals("R/2019-01-01T00:00:00/P1D") This will give me an iterator with infinite number of daily recurring instances starting from the beginning of 2019. Is it…
Arho Huttunen
  • 1,081
  • 9
  • 16
1
vote
1 answer

How can I convert timestamp to time4j Moment format?

I have a problem with Time4J library, I can not convert specific timeStamp to Moment format. for example, I want something like this: Moment.timeInMillies = myTime or Moment.of(myTime) myTime is a long value of milliseconds since the epoch, which…
Amir Hossein Ghasemi
  • 20,623
  • 10
  • 57
  • 53
1
vote
2 answers

Converting time4j Duration from P365D to P1Y and so on

Instant i1 = Instant.now(); Instant i2 = Instant.now().plusSeconds(60 * 60 * 24 * 365); Duration dur = Duration.from((TemporalAmount) java.time.Duration.between(i1, i2)); System.out.println(dur); this code prints P365D, is there a way to…
1
vote
1 answer

How can I get exact UTC current time stamp at time4j without usage of system timezone and system clock?

there! I have to get the accurate current UTC time without calling a system clock or system time zone. I need to get precise UTC time via the Time4j library. The issue that after getting UTC time via different ways there is a mismatch in accuracy…
Roman Shabanov
  • 152
  • 2
  • 11
1
vote
1 answer

Style a regular javafx button and text-field?

I'm using Time-4j-ui library, and somehow it includes a built-in Button and a text box which is Ugly and ruins all my design, In my project I'm using Jfoenix material design components, and this built-in user-interface completely ruins my design,…
Shaheen Zahedi
  • 1,216
  • 3
  • 15
  • 40
1
vote
1 answer

How to Format Hijri Date

I'm using time4A to do transformation from Islamic Hjiri to Gregorian Date and vice versa. I'm not able to find a way to format Hijri Date to "yyyy/mmm/dd" pattern. Here is the code to convert from Gregorian to Hijri : CalendarVariant variant…
abdou amer
  • 819
  • 2
  • 16
  • 43
1
vote
1 answer

year number convert from gregorian to hijri java time4j

I take a year number from user. How can convert it to hijri year number? Better using not jodatime but time4j or java 8. Example: I need from 2016 to have hijri year number. I have found this post, Is there any library or algorithm for Persian…
Seomat
  • 133
  • 9
0
votes
0 answers

Getting error when using jlink to create a runtime image with Time4J CalendarPicker

I am using the Time4J library's Persian calendar picker. When I run the app with ./gradlew run I see it running. But when I launch the JavaFX runtime image of the app, that I build using the Badass JLink Plugin, I get this error: Caused by:…
pooya
  • 1
  • 3
0
votes
1 answer

time4j is not producing monotonic time in long since epoch

I'm trying to produce monotonic time in long since epoch using time4j v5.6 using below test code But output is not expected. Did I miss any initialization of the library? My objective is to produce monotonic time but don't need high precision as…
sigirisetti
  • 329
  • 2
  • 10
0
votes
2 answers

How many days from now is the Duration?

I have a Duration, like P3M (3 months). How can I get number of days it is from now? All I have now is this: Duration.parseWeekBasedPeriod("P3M") I know the period parameter will never be shorter than 1 week, so parseWeekBasedPeriod() should be ok.…
Pitel
  • 5,334
  • 7
  • 45
  • 72
0
votes
1 answer

get number of days in month with time4j

Is there a way to get number of days in a month using time4j lib? in android default calendar, we can get it so simple like below Calendar calendar=Calendar.getInstance(); int numOfDaysInMonth=calendar.getActualMaximum(Calendar.DAY_OF_MONTH);…
max
  • 5,963
  • 12
  • 49
  • 80
1
2