Wednesday 19 March 2014

date functions


DateFromDaysSince
Returns a date by adding an integer to a baseline date. The integer can be negative to return a date that is earlier than the base date.
  • Input: number (int32), [baseline_date (date)]
  • Output: date
  • Examples. If mylink.myintcol contains the integer 18250, and mylink.mydatecol contains the date 1958–08–18, then the three following functions are equivalent, and return the date 2008–08–05:
    DateFromDaysSince(18250,"1958-08-18")
    DateFromDaysSince(mylink.myintcol,"1958-08-18")
    DateFromDaysSince(mylink.myintcol,mylink.mydatecol)
    If mylink.mynegintcol contains the integer -1, and mylink.mydatecol contains the date 1958–08–18, then the following three functions are equivalent, and return the date 1958–08–17:
    DateFromDaysSince(-1,"1958-08-18")
    DateFromDaysSince(mylink.mynegintcol,"1958-08-18")
    DateFromDaysSince(mylink.mynegintcol,mylink.mydatecol)
DaysSinceFromDate
Returns the number of days from source date to the given date.
  • Input: source_date, given_date
  • Output: days_since (int32)
  • Examples. If mylink.mysourcedate contains the date 1958–08–18 and mylink.mygivendate contains the date 2008–08–18, then the two following functions are equivalent, and return the integer value 18263.
    DaysSinceFromDate(mylink.mysourcedate, mylink.mygivendate)
    DaysSinceFromDate("1958-08-18","2008-08-18")
DaysInMonth
Returns the number of days in the month in the given basedate.
  • Input: basedate (date)
  • Output: daysinmonth (int32)
  • Examples. If mylink.mysourcedate contains the date 1958–08–18, then the two following functions are equivalent, and return the integer value 31.
    DaysInMonth(mylink.mysourcedate)
    DaysInMonth("1958-08-18")
DaysInYear
MonthDayFromDate
Returns the day of the month from the given date.
  • Input: date
  • Output: day (int8)
  • Examples. If mylink.mydate contains the date 2008-08-18, then the two following functions are equivalent, and return the value 18:
    MonthDayFromDate("2008-08-18")
    MonthDayFromDate(mylink.mydate)
MonthFromDate
Returns the month number from the given date.
  • Input: date
  • Output: month_number (int8)
  • Examples. If mylink.mydate contains the date 2008-08-18, then the two following functions are equivalent, and return the value 8:
    MonthFromDate("2008-08-18")
    MonthDayDate(mylink.mydate)
NextWeekdayFromDate
Returns the date of the specified day of the week soonest after the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu.
  • Input: sourcedate (date), day_of_week (string)
  • Output: date
  • Examples. If mylink.mysourcedate contains the date 2008-08-18, then the two following functions are equivalent, and return the value 2008–08–21:
    NextWeekdayFromDate("2008-08-18", "thursday")
    NextWeekdayFromDate(mylink.mysourcedate, "thu")
NthWeekdayFromDate
Returns the date of the specified day of the week offset by the specified number of weeks from the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu. The offset can be positive, negative, or zero.
  • Input: basedate (date), day_of_week (string), week_offset (int32)
  • Output: date
  • Examples. If mylink.mydate contains the date 2009-08-18, then the two following functions are equivalent, and return the value 2009–08–27:
    NthWeekdayFromDate("2009-08-18", "thursday", 1)
    NthWeekdayFromDate(mylink.mydate, "thu", 1)
    If mylink.mydate contains the date 2009-08-18, then the two following functions are equivalent, and return the value 2009–08–06:
    NthWeekdayFromDate("2009-08-18", "thursday", -2)
    NthWeekdayFromDate(mylink.mydate, "thu", -2)
PreviousWeekdayFromDate
Returns the date of the specified day of the week most recent before the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu.
  • Input: sourcedate, day_of_week (string)
  • Output: date
  • Examples. If mylink.mysourcedate contains the date 2008-08-18, then the two following functions are equivalent, and return the value 2008–08–14:
    PreviousWeekdayFromDate("2008-08-18", "thursday")
    PreviousWeekdayFromDate(mylink.mysourcedate, "thu")
SecondsFromTime

No comments:

Post a Comment