Skip to content

C# SDK

Install

dotnet add package TimeNow

Quick Start

using TimeNow;

var client = new TimeNowClient("http://localhost:8090");

// Solar time for London
var result = await client.GetSolarTimeAsync(51.5074, -0.1278);
Console.WriteLine(result.SolarTime);           // "2026-04-14T11:49:23"
Console.WriteLine(result.CivilSolarOffsetMin); // -10.6

// Social jetlag
var jetlag = await client.GetJetlagAsync(39.47, 75.99);
Console.WriteLine(jetlag.RiskLevel); // "severe"

// Prayer times
var prayers = await client.GetPrayerTimesAsync(51.5074, -0.1278, convention: "mwl");
Console.WriteLine(prayers.Dhuhr.Civil); // "13:11"

Methods

Method Parameters Returns API endpoint
GetSolarTimeAsync(lat, lng, utc?) double, double, string? Task<SolarTimeResult> GET /solar
GetJetlagAsync(lat, lng) double, double Task<JetlagResult> GET /solar/jetlag
GetPrayerTimesAsync(lat, lng, date?, convention?) double, double, string?, string? Task<PrayerTimesResult> GET /solar/prayer
GetAlmanacAsync(lat, lng, year?) double, double, int? Task<AlmanacResult> GET /solar/almanac
HealthAsync() Task<bool> GET /health

Types

public record SolarTimeResult(
    double Latitude,
    double Longitude,
    string Utc,
    string SolarTime,
    string CivilTime,
    double EquationOfTimeMin,
    double CivilSolarOffsetMin,
    string Timezone,
    string SolarNoonUtc,
    string SunriseUtc,
    string SunsetUtc
);