{"id":17867159,"url":"https://github.com/caarmen/sunrisesunset","last_synced_at":"2025-06-13T21:35:30.940Z","repository":{"id":6484337,"uuid":"7724622","full_name":"caarmen/SunriseSunset","owner":"caarmen","description":"Java utility to calculate the time of sunrise and sunset for a given location.","archived":false,"fork":false,"pushed_at":"2020-10-13T04:31:32.000Z","size":157,"stargazers_count":48,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T19:21:56.685Z","etag":null,"topics":["lib"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caarmen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-21T01:43:22.000Z","updated_at":"2024-09-07T00:18:38.000Z","dependencies_parsed_at":"2022-09-11T10:40:23.070Z","dependency_job_id":null,"html_url":"https://github.com/caarmen/SunriseSunset","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/caarmen/SunriseSunset","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caarmen%2FSunriseSunset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caarmen%2FSunriseSunset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caarmen%2FSunriseSunset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caarmen%2FSunriseSunset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caarmen","download_url":"https://codeload.github.com/caarmen/SunriseSunset/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caarmen%2FSunriseSunset/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259723758,"owners_count":22901968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lib"],"created_at":"2024-10-28T09:44:39.044Z","updated_at":"2025-06-13T21:35:30.918Z","avatar_url":"https://github.com/caarmen.png","language":"Java","readme":"SunriseSunset\n=============\n\nJava utility which provides methods to determine the sunrise, sunset, civil twilight,\nnautical twilight, and astronomical twilight times of a given\nlocation.\n\nAlso provides methods:\n* to convert between Gregorian and Julian dates.\n* to know if it is currently day or night at a given location.\n\nThe formulas used by this class are from the Wikipedia articles on [Julian Day] (http://en.wikipedia.org/wiki/Julian_day)\nand [Sunrise Equation] (http://en.wikipedia.org/wiki/Sunrise_equation).\n  \nAdding the dependency\n=====================\n\nGradle:\n-------\nAdd this repository:\n```\nmaven { url \"https://dl.bintray.com/caarmen/maven/\" }\n```\n\nDeclare the dependency:\n```\ncompile 'ca.rmen:lib-sunrise-sunset:1.1.1'\n```\nMaven:\n------\nAdd this repository:\n```\n\u003crepository\u003e\n \u003cid\u003ecaarmen-repo\u003c/id\u003e\n \u003curl\u003ehttps://dl.bintray.com/caarmen/maven/\u003c/url\u003e\n\u003c/repository\u003e\n```\nDeclare the dependency:\n```\n\u003cdependency\u003e\n \u003cgroupId\u003eca.rmen\u003c/groupId\u003e\n \u003cartifactId\u003elib-sunrise-sunset\u003c/artifactId\u003e\n \u003cversion\u003e1.1.1\u003c/version\u003e\n \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nAny other build system:\n-------------------\n\nAlternatively, you can just copy the single java file into your project:\n[library/src/main/java/ca/rmen/sunrisesunset/SunriseSunset.java](library/src/main/java/ca/rmen/sunrisesunset/SunriseSunset.java)\n\nUsing the library\n=================\nTo get the sunrise and sunset times for today in Paris, France:\n```\nCalendar[] sunriseSunset = ca.rmen.sunrisesunset.SunriseSunset.getSunriseSunset(Calendar.getInstance(), 48.85837, 2.294481);\nSystem.out.println(\"Sunrise at: \" + sunriseSunset[0].getTime());\nSystem.out.println(\"Sunset at: \" + sunriseSunset[1].getTime());\n```\n\nThe civil, nautical, and astronomical twilight times are retrieved in the same way:\n```\nCalendar[] civilTwilight = ca.rmen.sunrisesunset.SunriseSunset.getCivilTwilight(Calendar.getInstance(), 48.85837, 2.294481);\nSystem.out.println(\"Civil twilight stops at: \" + civilTwilight[0].getTime());\nSystem.out.println(\"Civil twilight starts at: \" + civilTwilight[1].getTime());\n\nCalendar[] nauticalTwilight = ca.rmen.sunrisesunset.SunriseSunset.getNauticalTwilight(Calendar.getInstance(), 48.85837, 2.294481);\nSystem.out.println(\"Nautical twilight stops at: \" + nauticalTwilight[0].getTime());\nSystem.out.println(\"Nautical twilight starts at: \" + nauticalTwilight[1].getTime());\n\nCalendar[] astronomicalTwilight = ca.rmen.sunrisesunset.SunriseSunset.getAstronomicalTwilight(Calendar.getInstance(), 48.85837, 2.294481);\nSystem.out.println(\"Astronomical twilight stops at: \" + astronomicalTwilight[0].getTime());\nSystem.out.println(\"Astronomical twilight starts at: \" + astronomicalTwilight[1].getTime());\n```\n\nCommand-line interface\n======================\n\nA command-line tool is provided. You can download it from the [releases page](https://github.com/caarmen/SunriseSunset/releases)\nor build it with `mvn clean package`, which will place it in `cli/target`.\n\nUsage:\n\n```\njava -jar /path/to/sunrise-sunset-cli-1.1.1.jar \u003ctimezone\u003e \u003cyyyyMMdd\u003e \u003clatitude\u003e \u003clongitude\u003e\n```\n\nExample usage:\n```\njava -jar /path/to/sunrise-sunset-cli-1.1.1.jar Europe/Paris 20171125 48.8 2.35\nCurrent time at: 48.8,2.35:\n  2017-11-25 18:01:42 Central European Time\nCurrent day period is NAUTICAL_TWILIGHT\nDay is 31588000 milliseconds long\nLookup for date:\n  2017-11-25 12:00:00 Central European Time\nSunrise, Sunset:\n  2017-11-25 08:15:53 Central European Time\n  2017-11-25 17:02:21 Central European Time\nCivil twilight:\n  2017-11-25 07:40:16 Central European Time\n  2017-11-25 17:37:58 Central European Time\nNautical twilight:\n  2017-11-25 07:01:06 Central European Time\n  2017-11-25 18:17:08 Central European Time\nAstronomical twilight:\n  2017-11-25 06:23:26 Central European Time\n  2017-11-25 18:54:48 Central European Time\nSolar noon:\n  2017-11-25 12:39:07 Central European Time\n```\n\n\nDocumentation\n=============\nJavadoc is here: http://caarmen.github.io/SunriseSunset/ca/rmen/sunrisesunset/SunriseSunset.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaarmen%2Fsunrisesunset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaarmen%2Fsunrisesunset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaarmen%2Fsunrisesunset/lists"}