DaylightQ

DaylightQ[]
gives True if it is currently daylight from the user's location.

DaylightQ[datespec]
gives True if it is daylight from the user's location on the specified datespec.

DaylightQ[locationspec]
gives True if it is currently daylight from the specified locationspec.

DaylightQ[locationspec,datespec]
gives True if it is daylight from the specified locationspec on the specified datespec.

DaylightQ[{{location1,date1},{location2,date2},}]
gives True if it is daylight from the specified locations and dates.

DaylightQ[locationspec,datespec,inclusionspec]
gives True if it is daylight from the specified locationspec on the specified datespec taking inclusionspec into account.

Details and OptionsDetails and Options

  • DaylightQ[] makes use of $GeoLocation and $TimeZone to determine your location and time zone.
  • Locations can be specified as Entity objects, assuming they represent objects with geographic coordinates or GeoGraphics primitives, or they can be latitude/longitude pairs, assuming degrees as units.
  • Dates can be specified as a DateObject or as a string that resolves to a date.
  • locationspec and datespec can be either individual items or lists of them.
  • If datespec is a list of dates, then the results will contain EventSeries objects.
  • datespec can be specified as for compatibility with DateRange specifications.
  • DaylightQ[,inclusionspec] is used to specify how much of the locationspec must be in daylight.
  • Possible settings for inclusionspec include:
  • "Everywhere"all of the locationspec must be in daylight
    "Somewhere"some of the locationspec must be in daylight
    "Nowhere"none of the locationspec must be in daylight
  • DaylightQ can accept the following option:
  • "SunAngleTest"(#>0&)function applied to the Sun altitude angle to determine if it is daylight

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

Determine if it is currently daylight for your location:

In[1]:=
Click for copyable input
Out[1]=

Determine if it is daylight for a specified date:

In[1]:=
Click for copyable input
Out[1]=

Determine if it is currently daylight for a specified location:

In[1]:=
Click for copyable input
Out[1]=

Determine if it is daylight for a specified latitude/longitude and date:

In[1]:=
Click for copyable input
Out[1]=

Determine if it is currently daylight for a specified city and date:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)