Sunset

Sunset[]

gives the time of the next sunset for the current date and location.

Sunset[datespec]

gives the time of the next sunset for the specified dates.

Sunset[locationspec]

gives the times of the next sunset for the specified locations.

Sunset[locationspec,datespec]

gives the time of the next sunset for the specified date and location.

Sunset[{{location1,date1},{location2,date2},}]

gives the times of the next sunset for all specified locations on the specified dates.

Sunset[locationspec,datespec,func]

uses func to determine what to return for extended locations.

Details and Options

  • Sunset[] makes use of $GeoLocation and $TimeZone to determine your location and time zone.
  • Results are given to minute resolution in the specified TimeZone.
  • 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 {start,end,increment} for compatibility with DateRange specifications.
  • Sunset[,func] is used to specify the format of output when locations are specified.
  • Possible settings for func include:
  • Automaticreturns intervals for extended locations only
    Intervalreturns intervals for all specified locations
    Meanreturns mean value for extended locations
    Minreturns minimum values for extended locations
    Maxreturns maximum values for extended locations
    StandardDeviationreturns standard deviation for extended locations
  • Sunrise[TimeZone->z] gives the date of the next sunset with date and time inferred for time zone z by assuming that your computer is set for the time zone specified by $TimeZone.
  • Sunset[TimeDirection->-1] gives the date of the last sunset.
  • Sunset can accept the following options:
  • TimeDirection1whether to return the next or last Sunrise
    TimeZone$TimeZonetime zone to be used for dates
  • Possible settings for TimeDirection include:
  • 1returns the next sunset from the specified date
    -1returns the last sunset from the specified date
  • Calculations are based on atmospheric refraction models that cannot be accurately predicted. This, combined with local topography deviations, can result in errors on the order of several minutes from actual observed times.

Examples

open allclose all

Basic Examples  (6)

Compute the next sunset for your current location:

Compute the next sunset after a specified date:

Compute the next sunset for a specified location:

Compute the next sunset for a specified latitude/longitude and date:

Compute the next sunset for a specified city and date:

Generate the time of the next sunset:

Scope  (11)

Dates  (3)

Dates can be specified as a DateObject:

Dates can be specified as a date string:

Generate the next sunset for a range of dates:

Locations  (6)

Locations can be latitude/longitude pairs:

Locations can include elevation:

Cities are treated as single, specific locations:

Results for extended locations are intervals, by default:

The form of the results for extended locations can be overridden:

Generate the next sunset for multiple locations:

Time Zones  (2)

Find the sunset in Greenwich, United Kingdom:

Find the sunset for a specified location and time in GMT:

Options  (2)

TimeZone  (1)

Find the sunset in Greenwich, United Kingdom:

TimeDirection  (1)

Find the last sunset for your location:

Applications  (1)

Determine your final location if you walk toward the Sun from sunrise to sunset at a constant speed:

Iterate the bearing in 10-minute increments to obtain a new course and destination:

Visualize the resulting path:

Find the distance between the starting and ending points:

Properties & Relations  (2)

By default, location is specified by $GeoLocation and the date is specified by the current date:

Results are in the form of an EventSeries when a range of dates is specified:

Possible Issues  (2)

Since the value of $TimeZone may change throughout the year, the results for specified dates may vary depending on when you evaluate the input:

If the above behavior is a concern, the TimeZone option can be used to enforce a consistent value:

With Sunset[location,Interval], results for specific locations are coerced into intervals:

Neat Examples  (4)

Plot the position of the Sun for your location between sunrise and sunset for the solstices and equinox:

Generate a map of Italy with the illumination set for sunset:

Generate a table of sunsets for the capital cities in Europe and display only the first and last five:

Plot the length of daylight throughout a given year:

Introduced in 2014
 (10.0)