GraffitiLocale

View Categories

Usage #

This module is initialized when the Locale property is assigned or when one of the methods are called. The default locale is “en”. “en-US” defaults to “en”.

Enumerations #

Name Values
ComparisonResult LessThan
EqualTo
GreaterThan
Error
Intervals Date
Time
Day
Month
Year
Hour
Minute
Second
TotalSeconds

Constants #

Name Type Value
This module exposes no constants.

Methods #

Definition Description
ActualAbbreviation( extends zone as TimeZone ) As String Returns the actual abbreviation for the TimeZone, such as “EST”. Xojo currently returns geographic identifiers.
Add( extends d As DateTime, Amount as Integer, Interval as Intervals ) As DateTime Adds the specified amount of time to the Date object.
Add( extends d As DateTime, IncrementPeriod as String ) As DateTime
Add( extends d As DateTime, TotalSeconds as Integer ) As DateTime
Compare( Extends d As DateTime, CompTo As DateTime, CompType as ComparisonTypes ) As ComparisonResult Will compare two date objects, and return a ComparisonResult enum value of GreaterThan, LessThan, or EqualTo
CurrencyDecimalDigits( CurrencyCode as String ) As Integer Returns the number of digits expected on a currency type for the specified currency code.
CurrencyName( CurrencyCode as String, Plural as Boolean = False ) As String Returns the localized name for the currency code specified. IE: for USD with Plural = False the result is “U.S. Dollar”, and with Plural = True the result is “U.S. dollars”
CurrencySymbol( currencyCode as String, Native as Boolean = True ) Returns the symbol for currency of the specified currency code. IE: USD will return “$”for Native = True, and “US$” for Native = False
DayName( DayNumber as Integer ) As String Returns the full day name (IE: Wednesday) for the specified DayNumber
DayName( Extends d As DateTime ) As String Returns the day name for the Day property of the passed object.
DayNameMin( DayNumber as Integer ) As String Returns the minimal day name (IE: “We” for Wednesday) for the specified DayNumber
DayNameMin( Extends d As DateTime ) As String Returns the minimal day name (IE: “We” for Wednesday) for the Day property of the passed object.
DayNameShort( DayNumber as Integer ) As String Returns the short day name (IE: “Wed” for Wednesday) for the specified DayNumber
DayNameShort( Extends d As DateTime ) As String Returns the short day name (IE: “Wed” for Wednesday) for the Day property of the passed object.
Description( zone as TimeZone ) As String Returns a description of the TimeZone, such as human readable offset and region.
Format( Extends d As DateTime, formatString as String ) as String Formats the date of the passed object according to the mask assigned to formatString
From( Extends d As DateTime, dTarget As DateTime ) As String Returns a localized string of time difference between d and dTarget. IE: A difference of three seconds will result in either “in a few seconds” or “a few seconds ago”dependent on values.
FromNow( Extends dTarget As DateTime ) Returns a localized string of time difference between d and Now. IE: A difference of three seconds will result in either “in a few seconds”or “a few seconds ago” dependent on values.
isAM( Extends d As DateTime ) As Boolean Returns True if the meridiem of the time represented in the Date object is before noon.
isDaylightSavings( extends zone As TimeZone ) As Boolean Returns whether the current TimeZone is modified by daylight savings.
isPM( Extends d As DateTime ) As Boolean Returns True if the meridiem of the time represented in the Date object is after noon.
Meridiem( extends d As DateTime, isUppercase as Boolean = False ) As String Returns the string representing the meridiem of the current time (IE: “AM” or “PM” )
MonthName( MonthNumber as Integer ) As String Returns the full month name (IE: December) for the specified MonthNumber
MonthName( Extends d As DateTime ) As String Returns the month name for the Month property of the passed object.
MonthNameShort( MonthNumber as Integer ) As String Returns the short month name (IE: “Dec”) for the specified MonthNumber
MonthNameShort( Extends d As DateTime ) As String Returns the short month name for the Month property of the passed object.
Now() As DateTime Returns a date object representing the current date/time.
Regions( extends zone As TimeZone ) As String() List of regions that observe this TimeZone.
Subtract( extends d As DateTime, Amount as Integer, Interval as Intervals ) As DateTime Subtracts the specified amount of time to the Date object.
Subtract( extends d As DateTime, IncrementPeriod as String ) As DateTime
Subtract( extends d As DateTime, TotalSeconds as Integer ) As DateTime
SystemLocale() As String Returns the current system’s language code.
toCurrency( extends v as Double, currencyCode as String = “USD”, Native as Boolean = True ) As String Converts a Double value to a localized currency string.
toDecimal( extends v as Double, numberOfDecimals as Integer ) As String Converts a Double value to a localized decimal string.
toPercent( extends v as Double, numberOfDecimals as Integer ) As String Converts a Double value to a localized percentage string.

Properties #

Name Type Default Value Description
LocaleID String System Value The Locale Identifier used when returning string/text values from the GraffitiDateLocalization methods.
LongDateFormat String “” The format string that will be applied to a date object when using the Format functions.
LongTimeFormat String “”
ShortDateFormat String “”
ShortTimeFormat String “”
PatternNegativeCurrency String “” Pattern applied to currency with negative values.
PatternNegativeDecimal String “” Pattern applied to decimals with negative values.
PatternNegativePercent String “” Pattern applied to percentages with negative values.
PatternPositiveCurrency String “” Pattern applied to currency with positive values.
PatternPositiveDecimal String “” Pattern applied to decimals with positive values.
PatternPositivePercent String “” Pattern applied to percentages with positive values.
SupportedCurrencies Xojo.Core.Dictionary Nil All supported currency data.
SupportedLocales() String Nil All support language locales.
SymbolDecimal String “” The symbol used to separate fractional from whole values.
SymbolGroup String “” The symbol used to separate groups of numbers such as thousands and millions.
SymbolInfinity String “” The symbol used in place of Infinite values.
SymbolMinus String “” The symbol used to denote negative values.
SymbolNaN String “” Localized string when user provides a value that is not a number.
SymbolPercent String “” The symbol used to denote that a value is a percentage.
SymbolPlus String “” The symbols used to denote positive values.
TimeZones() Dictionary Populated Raw TimeZone data.

Date Formatting Tokens #

“m” Returns a single or double digit representation of the month number.
“mm” Returns a double digit representation of the month number.
“mmm” Returns the short month name, IE: “dec” for December.
“mmmm” Returns the full month name, IE: “December.
“d” Returns a single digit representation of the day number.
“dd” Returns a double digit representation of the day number.
“ddd” Returns the minimum day name, IE: “Mo” for Monday.
“dddd” Returns the short day name, IE: “Mon” for Monday.
“ddddd” Returns the full day name, IE: “Monday”.
“y”, “yy” Returns a two digit representation of the year, IE: “18” for 2018.
“yyyy” Returns a four digit representation of the year, IE: “2018”.
“yyyyy” Returns a five digit representation of the year, IE: “02018” for 2018.
“[literal]” Encasing a string in “[]” brackets makes the contents a string literal, and they will not be interpreted.

Time Formatting Tokens #

“h” Returns a single or double digit representation of the hour.
“hh” Returns a double digit representation of the hour.
“hhh” Returns a meridiem normalized single or double digit representation of the hour, IE: “1” for hour 13.
“hhhh” Returns a meridiem normalized double digit representation of the hour, IE: “01” for hour 13.
“n” Returns a single or double digit representation of the minute.
“nn” Returns a double digit representation of the minute.
“s” Returns a single or double digit representation of the second.
“ss” Returns a double digit representation of the second.
“t” Returns the current lowercased meridiem value, IE: “pm” for hour 13.
“tt” Returns the current uppercased meridiem value, IE: “PM” for hour 13.
“[literal]” Encasing a string in “[]” brackets makes the contents a string literal, and they will not be interpreted.

Add/Subtract String Values #

The “Add” and “Subtract” methods have an overload for accepting a string value with which to modify the date object. These are automatically parsed to perform the desired arithmetic. An IntervalPeriod of “1d”, in the example below would add one day to the extended Date object.

myDate.Add( "1d" )
“s” Seconds
“m” Minutes
“h” Hours
“d” Days
“M” Months
“y” Years

Examples #

Formatting #

For a date object with the value of 2018-04-18 08:30:00, applying the format “mm-dd[lit]-yyyy” to Format will result in “04-18lit-2018”. Applying the format “hh\ss[lit]-mm:tt”to Format will result in “18\00lit-30:PM”.