Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #261848

Re: Sunrise and Sunset from terminal

From Stefano <sl91@gmx.com>
Newsgroups linux.debian.user
Subject Re: Sunrise and Sunset from terminal
Date 2023-09-24 11:30 +0200
Message-ID <HhtB8-bbWK-7@gated-at.bofh.it> (permalink)
References (1 earlier) <Hhjs5-b2dz-3@gated-at.bofh.it> <HhjBL-b2hD-3@gated-at.bofh.it> <HhjV7-b2E2-9@gated-at.bofh.it> <Hhlkd-b3LN-3@gated-at.bofh.it> <HhnFn-b7lc-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Cool this site..i didn't know it..thanks....

Il 24 Settembre 2023 05:00:45 CEST, Greg Wooledge <greg@wooledge.org> ha scritto:
>On Sun, Sep 24, 2023 at 12:35:18AM +0000, Andy Smith wrote:
>> $ curl -s 'https://api.sunrise-sunset.org/json?lat=51.509865&lng=-0.118092&formatted=0' | jq .
>> {
>>   "results": {
>>     "sunrise": "2023-09-24T05:47:54+00:00",
>>     "sunset": "2023-09-24T17:57:14+00:00",
>>     "solar_noon": "2023-09-24T11:52:34+00:00",
>>     "day_length": 43760,
>>     "civil_twilight_begin": "2023-09-24T05:16:19+00:00",
>>     "civil_twilight_end": "2023-09-24T18:28:49+00:00",
>>     "nautical_twilight_begin": "2023-09-24T04:37:02+00:00",
>>     "nautical_twilight_end": "2023-09-24T19:08:06+00:00",
>>     "astronomical_twilight_begin": "2023-09-24T03:56:14+00:00",
>>     "astronomical_twilight_end": "2023-09-24T19:48:54+00:00"
>>   },
>>   "status": "OK"
>> }
>> 
>> The documentation is here:
>> 
>>     https://sunrise-sunset.org/api
>
>Yes, that's pretty reasonable.  The times are given in UTC, so they
>must be converted.  Fortunately, GNU date can do that for us.
>
>As a one-liner:
>
>unicorn:~$ curl -s 'https://api.sunrise-sunset.org/json?lat=41.4483&lng=-82.1689&formatted=0' | jq -r .results.sunrise,.results.sunset | { read -r sunrise; read -r sunset; date "+Sunrise: %R" -d "$sunrise"; date "+Sunset: %R" -d "$sunset"; }
>Sunrise: 07:16
>Sunset: 19:24
>
>As a script:
>
>#!/bin/sh
>lat=41.4483
>lng=-82.1689
>curl -s "https://api.sunrise-sunset.org/json?lat=$lat&lng=$lng&formatted=0" |
>  jq -r .results.sunrise,.results.sunset | {
>    read -r sunrise
>    read -r sunset
>    date "+Sunrise: %R" -d "$sunrise"
>    date "+Sunset: %R" -d "$sunset"
>  }
>

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Sunrise and Sunset from terminal "sl91@gmx.com" <sl91@gmx.com> - 2023-09-24 00:00 +0200
  Re: Sunrise and Sunset from terminal ghe2001 <ghe2001@protonmail.com> - 2023-09-24 00:00 +0200
  Re: Sunrise and Sunset from terminal piorunz <piorunz@gmx.com> - 2023-09-24 00:40 +0200
    Re: Sunrise and Sunset from terminal Felix Miata <mrmazda@earthlink.net> - 2023-09-24 00:50 +0200
      Re: Sunrise and Sunset from terminal piorunz <piorunz@gmx.com> - 2023-09-24 01:00 +0200
        Re: Sunrise and Sunset from terminal Felix Miata <mrmazda@earthlink.net> - 2023-09-24 01:30 +0200
          Re: Sunrise and Sunset from terminal piorunz <piorunz@gmx.com> - 2023-09-24 01:40 +0200
          Re: Sunrise and Sunset from terminal Charles Curley <charlescurley@charlescurley.com> - 2023-09-24 05:00 +0200
      Re: Sunrise and Sunset from terminal Greg Wooledge <greg@wooledge.org> - 2023-09-24 01:10 +0200
        Re: Sunrise and Sunset from terminal piorunz <piorunz@gmx.com> - 2023-09-24 01:50 +0200
        Re: Sunrise and Sunset from terminal Andy Smith <andy@strugglers.net> - 2023-09-24 02:40 +0200
          Re: Sunrise and Sunset from terminal piorunz <piorunz@gmx.com> - 2023-09-24 03:00 +0200
          Re: Sunrise and Sunset from terminal Greg Wooledge <greg@wooledge.org> - 2023-09-24 05:10 +0200
            Re: Sunrise and Sunset from terminal Stefano <sl91@gmx.com> - 2023-09-24 11:30 +0200
  Re: Sunrise and Sunset from terminal Nate Bargmann <n0nb@n0nb.us> - 2023-09-24 05:00 +0200
  Re: Sunrise and Sunset from terminal Tom Browder <tom.browder@gmail.com> - 2023-09-24 22:40 +0200
  Re: Sunrise and Sunset from terminal Carles Pina i Estany <carles@pina.cat> - 2023-09-27 12:20 +0200
    Re: Sunrise and Sunset from terminal Curt <curty@free.fr> - 2023-09-27 17:50 +0200
    Re: Sunrise and Sunset from terminal Sven Hoexter <sven@stormbind.net> - 2023-09-29 16:10 +0200
  Re: Sunrise and Sunset from terminal Bruno Kleinert <fuddl@debian.org> - 2023-09-29 18:50 +0200
    Re: Sunrise and Sunset from terminal Karl Vogel <vogelke@pobox.com> - 2023-09-29 23:40 +0200

csiph-web