ScriptForge.Region zerbitzua

Region zerbitzuak eskualde-ezarpenei lotutako programazio-kontuak maneiatzeko erabili daitezkeen propietateen bilduma bat eskaintzen du. Honakoak egiteko erabili daitezke:

Definizioak

Eskualdeko ezarpena edo eskualdea

A string combining a language and a country in the format "la-CO". The language part is expressed with 2 or 3 lowercase characters followed by a dash and 2 uppercase characters representing the country.

For instance, "en-US" corresponds to the English language in the United States; "fr-BE" corresponds to the French language in Belgium, and so forth.

Zenbait kasutan, ez da beharrezkoa eskualde-ezarpen osoa erabiltzea, eta aski da hizkuntza edo herrialdea zehaztearekin.

note

Most properties and methods accept a locale as argument. If no locale is specified, then the user-interface locale is used, which is defined in the OfficeLocale property of the Platform service.


Ordu-zona

A string in the format "Region/City" such as "Europe/Berlin", or a timezone ID such as "UTC" or "GMT-8:00". Refer to the wiki page List of tz database and timezones for a list of possible timezone names and IDs.

warning

Providing an invalid timezone string to any of the methods in the Region service will not result in a runtime error. Instead, methods as UTCDateTime and UTCNow will return the current operating system date and time.


The time offset between the timezone and the Greenwich Meridian Time (GMT) is expressed in minutes.

Udako ordutegia (DST) desplazamendu gehigarria da.

note

Denbora-zonaren eta DSTaren desplazamenduak positiboak edo negatiboak izan daitezke.


Zerbitzuari deitzea

Region zerbitzua erabiltzeko, lehenengo ScriptForge liburutegia kargatu edo inportatu behar da:

note

• Basic makroak erabiltzkeo, ScriptForge liburutegia kargatu behar da honako instrukzioa erabiliz:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Python scriptak erabiltzeko, berriz, scriptforge modulu baten inportazioa behar dute:
from scriptforge import CreateScriptService


The examples below in Basic and Python instantiate the Region service and access the Country property.

Basic lengoaian

    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
    Dim oRegion As Variant
    oRegion = CreateScriptService("Region")
    MsgBox oRegion.Country("en-US") ' United States
  
Python lengoaian

    from scriptforge import CreateScriptService
    oRregion = CreateScriptService("Region")
    bas = CreateScriptService("Basic")
    bas.MsgBox(oRegion.Country("en-US"))
  

Propietateak

All properties listed below accept a locale argument, provided as a string. Some properties require this argument to be in the format "la-CO", whereas others may receive "la" or "CO" as input.

Izena

Irakurtzeko soilik

Mota

Eskualde-ezarpena

Deskribapena

Country

Bai

String

"la‑CO"
"CO"

Emandako eskualde bati ingelesez dagokion herrialde-izena itzultzen du.

Currency

Bai

String

"la-CO"
"CO"

Zehaztutako eskualdearen ISo 4217 moneta-kodea itzultzen du.

DatePatterns

Bai

Kate-matrizea

"la-CO"

Zeron oinarritutako kate-matrize bat itzultzen du, zehaztutako eskualderako datak onartzeko ereduak dituena.

DateSeparator

Bai

String

"la-CO"

Emandako eskualdean erabiltzen den data-bereizlea itzultzen du.

DayAbbrevNames

Bai

Kate-matrizea

"la-CO"
"la"

Returns a zero-based array of strings containing the list of abbreviated weekday names in the specified language.

DayNames

Bai

String array

"la-CO"
"la"

Returns a zero-based array of strings containing the list of weekday names in the specified language.

DayNarrowNames

Bai

Kate-matrizea

"la-CO"
"la"

Returns a zero-based array of strings containing the list of the initials of weekday names in the specified language.

DecimalPoint

Bai

String

"la-CO"

Zehaztutako eskualdean zenbakietarako erabiltzen den dezimalen bereizlea itzultzen du.

Language

Bai

String

"la-CO"
"la"

Zehaztutako eskualdeko hizkuntzaren izena itzultzen du, ingelesez.

ListSeparator

Bai

String

"la-CO"

Zehaztutako eskualdean erabilitako zerrenda-bereizlea itzultzen du.

MonthAbbrevNames

Bai

Kate-matrizea

"la-CO"
"la"

Zeron oinarritutako kate-matrize bat itzultzen du zehaztutako hizkuntzako hilabete-izen laburtuekin.

MonthNames

Bai

Kate-matrizea

"la-CO"
"la"

Zeron oinarritutako kate-matrize bat itzultzen du zehaztutako hizkuntzako hilabete-izenen zerrendarekin.

MonthNarrowNames

Bai

String array

"la-CO"
"la"

Returns a zero-based array of strings containing the list of the initials of month names in the specified language.

ThousandSeparator

Bai

String

"la-CO"

Returns the thousands separator used in numbers in the specified region.

TimeSeparator

Bai

String

"la-CO"

Returns the separator used to format times in the specified region.


Region zerbitzuaren metodoen zerrenda

DSTOffset
LocalDateTime

Number2Text
TimeZoneOffset

UTCDateTime
UTCNow


DSTOffset

Emandako eskualde eta denbora-zona bati aplikatu dakiokeen udako ordutegiaren (DST) desplazamendu gehigarri kalkulatzen du, minututan.

Sintaxia:

svc.DSTOffset(localdatetime: date, timezone: str, opt locale: str): int

Parametroak:

localdatetime: Tokiko data eta ordua, data gisa adierazita.

timezone: Desplazamendua kalkulatuko zaion denbora-zona.

locale: the locale specifying the country for which the offset will be calculated, given either in "la-CO" or "CO" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      ' Calculates the offset applicable in the "America/Los_Angeles" timezone
      Dim aDateTime As Date, offset As Integer
      aDateTime = DateSerial(2022, 7, 1) + TimeSerial(16, 0, 0)
      offset = oRegion.DSTOffset(aDateTime, "America/Los_Angeles", "US") ' 60 (minutes)
      aDateTime = DateSerial(2022, 1, 1) + TimeSerial(16, 0, 0)
      offset = oRegion.DSTOffset(aDateTime, "America/Los_Angeles", "US") ' 0 (minutes)
    
Python lengoaian

      import datetime
      aDateTime = datetime.datetime(2022, 7, 1, 16, 0, 0)
      offset = oRegion.DSTOffset(aDateTime, "America/Los_Angeles", "US") ' 60 (minutes)
      aDateTime = datetime.datetime(2022, 1, 1, 16, 0, 0)
      offset = oRegion.DSTOffset(aDateTime, "America/Los_Angeles", "US") ' 0 (minutes)
    

LocalDateTime

Computes the local date and time from a UTC date and time.

Sintaxia:

svc.LocalDateTime(utcdatetime: date, timezone: str, opt locale: str): date

Parametroak:

utcdatetime: the UTC date and time, expressed using a date object.

timezone: the timezone for which the local time will be calculated.

locale: the locale specifying the country for which the local time will be calculated, given either in "la-CO" or "CO" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      ' June 6th, 2022 at 10:30:45 (used here as UTC time)
      Dim UTCTime As Date, localTime As Date
      UTCTime = DateSerial(2022, 6, 23) + TimeSerial(10, 30, 45)
      ' Calculates local time in Sao Paulo, Brazil
      ' June 6th, 2022 at 07:30:45
      localTime = oRegion.LocalDateTime(UTCTime, "America/Sao_Paulo", "BR")
    
Python lengoaian

      import datetime
      utcTime = datetime.datetime(2022, 6, 23, 10, 30, 45)
      localTime = oRegion.LocalDateTime(utcTime, "America/Sao_Paulo", "BR")
    

Number2Text

Converts numbers and monetary values into written text for any of the currently supported languages.

tip

For a list of all supported languages visit the XNumberText Interface API reference.


Sintaxia:

svc.Number2Text(number: any, opt locale: str): str

Parametroak:

number: the number to be converted into written text. It can be provided either as a numeric type or as a string. When a string is provided, it can be preceded by a prefix informing how the numbers should be written. It is also possible to include ISO 4217 currency codes. See examples below for more information.

locale: the locale defining the language into which the number will be converted to, given either in "la-CO" or "la" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      ' Returns "one hundred five"
      Dim numText As String
      numText = oRegion.Number2Text(105, "en-US")
      ' Returns: "two point four two"
      numText = oRegion.Number2Text(2.42, "en-US")
      ' Returns: "twenty-five euro and ten cents" Notice the "EUR" currency symbol
      numText = oRegion.Number2Text("EUR 25.10", "en-US")
      ' Returns: "fifteenth"; Notice the "ordinal" prefix
      numText = oRegion.Number2Text("ordinal 15", "en-US")
    
Python lengoaian

      numText = oRegion.Number2Text(105, "en-US")
      numText = oRegion.Number2Text(2.42, "en-US")
      numText = oRegion.Number2Text("EUR 25.10", "en-US")
      numText = oRegion.Number2Text("ordinal 15", "en-US")
    

To get a list of all supported prefixes in a given language, call Number2Text with the special "help" argument, as shown in the example below:


      prefixes = oRegion.Number2Text("help")
      MsgBox prefixes
      ' Considering the "en-US" locale the message box will show the following text
      ' bat, bi, hiru
      ' ordinal: first, second, third
      ' ordinal-number: 1st, 2nd, 3rd
      ' year: nineteen ninety-nine, two thousand, two thousand one
      ' currency (for example, USD): two U.S. dollars and fifty cents
      ' money USD: two and 50/100 U.S. dollars
    

The first line in the message box does not have a prefix, which means that it is the standard format. The subsequent lines include the prefix and some examples of numbers using its format.

note

Hizkuntza bakoitzak bere aurrizkien multzoa du.


TimeZoneOffset

GMT orduaren eta emandako ordu-zonaren eta eskualde-ezarpenaren arteko desplazamendua itzultzen du, minututan.

Sintaxia:

svc.TimeZoneOffset(timezone: str, opt locale: str): int

Parametroak:

timezone: the timezone for which the offset to the GMT will be calculated.

locale: the locale specifying the country for which the offset will be calculated, given either in "la-CO" or "CO" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      Dim offset As Integer
      offset = oRegion.TimeZoneOffset("America/New_York", "US") ' -300
      offset = oRegion.TimeZoneOffset("Europe/Berlin", "DE") ' 60
    
Python lengoaian

      offset = oRegion.TimeZoneOffset("America/New_York", "US") # -300
      offset = oRegion.TimeZoneOffset("Europe/Berlin", "DE") # 60
    

UTCDateTime

Returns the UTC date and time considering a given local date and time in a timezone.

Sintaxia:

svc.UTCDateTime(localdatetime: date, timezone: str, opt locale: str): date

Parametroak:

localdatetime: the local date and time in a specific timezone expressed as a date.

timezone: the timezone for which the localdatetime argument was given.

locale: the locale specifying the country for which the localdatetime argument was given, expressed either in "la-CO" or "CO" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      ' Date/Time in Berlin, June 23, 2022 at 14:30:00
      Dim localDT As Date, utcTime As Date
      localDT = DateSerial(2022, 6, 23) + TimeSerial(14, 30, 0)
      ' The UTC date/time is June 23, 2022 at 12:30:00
      utcTime = oRegion.UTCDateTime(localDT, "Europe/Berlin", "DE")
    
Python lengoaian

      import datetime
      localDT = datetime.datetime(2022, 6, 23, 14, 30, 0)
      utcTime = oRegion.UTCDateTime(localDT, "Europe/Berlin", "DE")
    

UTCNow

Returns the current UTC date and time, given a timezone and locale.

This method uses the current date and time of your operating system to calculate the UTC time.

Sintaxia:

svc.UTCNow(timezone: str, opt locale: str): date

Parametroak:

timezone: the timezone for which the current UTC time will be calculated.

locale: the locale specifying the country for which the current UTC time will be calculated, given either in "la-CO" or "CO" formats. The default value is the locale defined in the OfficeLocale property of the Platform service.

Adibidea:

Basic lengoaian

      ' Suppose the operating system time is June 23rd, 2022 at 10:42:00
      ' If the computer is in Europe/Berlin, then UTC time is June 23rd, 2022 at 08:42:00
      Dim utcTime As Date
      utcTime = oRegion.UTCNow("Europe/Berlin", "DE")
    
Python lengoaian

      utcTime = oRegion.UTCNow("Europe/Berlin", "DE")