GraffitiLocale

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
Add( extends d as Date, Amount as Integer, Interval as Intervals ) Adds the specified amount of time to the Date object.
Add( extends d as Date, IncrementPeriod as String )
Add( extends d as Date, TotalSeconds as Integer )
Add( extends d as Xojo.Core.Date, Amount as Integer, Interval as Intervals )
Add( extends d as Xojo.Core.Date, IncrementPeriod as String )
Add( extends d as Xojo.Core.Date, TotalSeconds as Integer )
Compare( Extends d as Date, CompTo as Date, CompType as ComparisonTypes ) As ComparisonResult Will compare two date objects, and return a ComparisonResult enum value of GreaterThan, LessThan, or EqualTo
Compare( extends d as Date, CompTo as Xojo.Core.Date, CompType as ComparisonTypes ) As ComparisonResult
Compare( extends d as Xojo.Core.Date, CompTo as Date, CompType as ComparisonTypes ) As ComparisonResult
Compare( extends d as Xojo.Core.Date, CompTo as Xojo.Core.Date, CompType as ComparisonTypes ) As ComparisonResult
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 Date ) As String Returns the day name for the Day property of the passed object.
DayName( Extends d as Xojo.Core.Date ) As String
DayNameMin( DayNumber as Integer ) As String Returns the minimal day name (IE: “We” for Wednesday) for the specified DayNumber
DayNameMin( Extends d as Date ) As String Returns the minimal day name (IE: “We” for Wednesday) for the Day property of the passed object.
DayNameMin( Extends d as Xojo.Core.Date ) As String
DayNameShort( DayNumber as Integer ) As String Returns the short day name (IE: “Wed” for Wednesday) for the specified DayNumber
DayNameShort( Extends d as Date ) As String Returns the short day name (IE: “Wed” for Wednesday) for the Day property of the passed object.
DayNameShort( Extends d as Xojo.Core.Date ) As String
Format( Extends d as Date, formatString as String ) as String Formats the date of the passed object according to the mask assigned to formatString
Format( Extends d as Xojo.Core.Date, formatString as String ) As String
From( Extends d as Date, dTarget as Date ) 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.
From( Extends d as Xojo.Core.Date, dTarget as Xojo.Core.Date ) as String
FromNow( Extends dTarget as Date ) 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.
FromNow( Extends dTarget as Xojo.Core.Date )
isAM( Extends d as Date ) As Boolean Returns True if the meridiem of the time represented in the Date object is before noon.
isAM( Extends d as Xojo.Core.Date ) As Boolean
isPM( Extends d as Date ) As Boolean Returns True if the meridiem of the time represented in the Date object is after noon.
isPM( Extends d as Xojo.Core.Date ) As Boolean
Meridiem( extends d as Date, isUppercase as Boolean = False ) As String Returns the string representing the meridiem of the current time (IE: “AM” or “PM” )
Meridiem( extends d as Xojo.Core.Date, isUppercase as Boolean = False ) As String
MonthName( MonthNumber as Integer ) As String Returns the full month name (IE: December) for the specified MonthNumber
MonthName( Extends d as Date ) As String Returns the month name for the Month property of the passed object.
MonthName( Extends d as Xojo.Core.Date ) As String
MonthNameShort( MonthNumber as Integer ) As String Returns the short month name (IE: “Dec”) for the specified MonthNumber
MonthNameShort( Extends d as Date ) As String Returns the short month name for the Month property of the passed object.
MonthNameShort( Extends d as Xojo.Core.Date ) As String
Now() As Date Returns a date object representing the current date/time.
Subtract( extends d as Date, Amount as Integer, Interval as Intervals ) Subtracts the specified amount of time to the Date object.
Subtract( extends d as Date, IncrementPeriod as String )
Subtract( extends d as Date, TotalSeconds as Integer )
Subtract( extends d as Xojo.Core.Date, Amount as Integer, Interval as Intervals )
Subtract( extends d as Xojo.Core.Date, IncrementPeriod as String )
Subtract( extends d as Xojo.Core.Date, TotalSeconds as Integer )
SystemLocale() As String Returns the current system’s language code.
toCoreDate( Extends d as Date ) As Xojo.Core.Date Converts an old framework Date object to a new framework Xojo.Core.Date object.
toCurrency( extends v as Double, currencyCode as String = “USD”, Native as Boolean = True ) As String Converts a Double value to a localized currency string.
toDate( Extends d as Xojo.Core.Date ) As Date Converts a new framework Xojo.Core.Date object to an old framework Date object.
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 symbold used to denote positive values.

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 represnetation 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”.