yeartodate#

yeartodate(year, as_date=True, **kwargs)[source]#

Convert a decimal year to a date

Parameters:
  • year (int, float) – The numerical year to convert to a DateTime

  • as_date (bool) – If True (default), return an sc.date object, otherwise return a string

Returns:

An sc.date object (default) or string, depending on the as_date argument

Example:

sc.yeartodate('2010-07-01') # Returns approximately 2010.5
New in version 3.2.1.