Questions tagged [date-sunrise]

12 questions
5
votes
3 answers

PHP date_sunrise and date_sun_info giving different results

I have a webcam website and I wanted to display the sunrise time for the actual day. So I used the date_sunrise function in PHP for this purpose. In addition to the coordinates, it takes the suns zenith value as input. I learned that the correct…
euphoria
  • 55
  • 6
5
votes
0 answers

Calculation of Sunrise and Sunset time in PHP

Note: this is a exercise for my curiosity and there are existing functions / code that solve this problem (see comments too) An algorithm for calculation of sunrise and sunset times can be found here and implementations at 1 in Tcl and 2 in…
mch
  • 1,259
  • 15
  • 23
2
votes
2 answers

Adding information on day/dusk/night/dawn for tracking data in R

I have a dataset with tracking data containing Datetime, Latitude and Longitude variables for several months which looks like this: > start <- as.POSIXct("2018-08-01 00:00:00", format="%Y-%m-%d %H:%M:%S", tz="UTC") > datetime <- seq(from = start,…
1
vote
0 answers

Calculating amount of time during day and night using date_sunrise() and date_sunset() php

I am trying to calculate the amount of hours during the day and during the night using the sunrise and sunset times returned by the date_sunrise() and the date_sunset() functions. Admittedly though I'm not really sure how to go about doing that. I…
Kaijudile
  • 59
  • 5
0
votes
0 answers

swift package dependency and location for sunset or sunrise time

I am testing out some code, just to play. Just to learn SwiftUI. The idea: I want to see on a map, my location and I want to see the sunrise and sunset times. I found on GitHub a package dependency: SunKit And I have a question. In Sunlit the…
0
votes
1 answer

Sunrise/ Sunset - Conversion of seconds to hh:mm

I'm building a weather app and I'm fetching weather and other information from openweathermap.org. I would like to get sunrise and sunset information for each of the searched location but I'm not sure how to change the format from seconds into…
0
votes
0 answers

How to combine dates from one dataset with sunrise and sunset times from another in R?

So I have my dataset titled WSW and I have done the sunrise and sunset functions to get the sunrise and sunset times from a series of dates which has created a second dataset titled df (see below code) df <- getSunlightTimes( date =…
Emma_94
  • 1
  • 1
0
votes
0 answers

R problem: some dawn/dusk calculations give NA, some give actual values

I am trying to determine if date/times are during dawn, dusk, night, or day. I am using the maptools library's sunriset() and crepuscule() functions. All of the sunrise and sunset calculations are working, but when I have it do dawn/dusk, I get…
L.Wild
  • 25
  • 3
0
votes
1 answer

Merge 2 timestamp data sets and create day/night column and dusk/dawn column in R

I have 2 data sets, one contains my data and the other contains the sunrise/sunset data from the NAVY Observatory. head(tagdata) X ID ex2 meanlat meanlong meanEast meanNorth meandepth rec numhits species depthcat …
0
votes
0 answers

Why won't my sunrise/sunset applescript give me the correct output?

I'm trying to write a code to determine sunrise and sunset for the current date and location. I use LocateMe for the latter, and I call it with do shell script "~...LocateMe", then use the -f function to get the latitude, longitude, and altitude. As…
DonielF
  • 169
  • 1
  • 9
0
votes
0 answers

Easiest way to calculate dusk and dawn from sunrise, sunset, latitude, and longitude

I'm willing to give up a little accuracy for simplicity. What is the easiest way to calculate both dawn and dusk times by using sunrise, sunset, latitude, and longitude? (Without using MATLAB or other such libraries.) I've seen this SO: how to…
MarkInTheDark
  • 244
  • 2
  • 15
-1
votes
1 answer

Show night / day icon (with php) using sunset / sunrise

What is the best method / script to echo an image after sunset and before sunrise with php. if (date("H:i") > date_sunset(time(), SUNFUNCS_RET_STRING, 51.29, 4.49, 90.7, 2)) { $icon = "icon_night"; } else { $icon = "icon_day"; } if (date("H:i") >…
Janneman
  • 11
  • 2