Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetYearMonthName

From RoR Wiki
Revision as of 19:45, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Time functions
Version: WAR 1.4.8

Returns a month and year written the way the computer's regional settings write them, for example as a calendar title.

text = GetYearMonthName(year, month)

Arguments

year
number – The year, 1900 or later. Fractions are dropped.
month
number – The month, 1 to 12. Fractions are dropped.

Returns

text
wstring – The formatted year and month.

Details

  • The text is produced by Windows' date formatting with the "year and month" format of the current thread locale, for the first day of the given month.
  • A year below 1900 or a month outside 1–12 logs the matching error and returns nothing.
  • If Windows cannot format the date, the third error is logged and an empty string is returned.
  • The argument check is shared with GetMonthName: if an argument is missing or not a number, the Invalid Parameters message names that function.
  • The function needs at least two arguments and only reads the last two.

Errors

These are written to the UI log; the call returns normally.

  • Error in function call 'GetYearMonthName': The year index[%u] is invalid. Year index should be greater than 1900!
  • Error in function call 'GetYearMonthName': The month index[%u] is invalid. Month index should be between 1 and 12!
  • Error in function call 'GetYearMonthName': Could not get valid year month name string for year[%u] month[%u]!

Example

From ea_guildwindow/source/calendar.lua:

LabelSetText( "CalendarYearMonthLabel", GetYearMonthName( Calendar.year, Calendar.month ) )

See also