Java SDK
Install
Quick Start
import io.github.koke1997.timenow.TimeNowClient;
import io.github.koke1997.timenow.model.SolarTimeResult;
import io.github.koke1997.timenow.model.JetlagResult;
public class Example {
public static void main(String[] args) throws Exception {
TimeNowClient client = new TimeNowClient("http://localhost:8090");
// Solar time for London
SolarTimeResult result = client.getSolarTime(51.5074, -0.1278, null);
System.out.println(result.getSolarTime()); // "2026-04-14T11:49:23"
System.out.println(result.getCivilSolarOffsetMin()); // -10.6
// Social jetlag
JetlagResult jetlag = client.getJetlag(39.47, 75.99);
System.out.println(jetlag.getRiskLevel()); // "severe"
}
}
Methods
| Method | Parameters | Returns | API endpoint |
getSolarTime(lat, lng, utc) | double, double, String | SolarTimeResult | GET /solar |
getJetlag(lat, lng) | double, double | JetlagResult | GET /solar/jetlag |
getPrayerTimes(lat, lng, date, convention) | double, double, String, String | PrayerTimesResult | GET /solar/prayer |
getAlmanac(lat, lng, year) | double, double, Integer | AlmanacResult | GET /solar/almanac |
health() | — | boolean | GET /health |