(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: GET_USERS_LANGUAGE, next: LP_LINES)


INIT_DATE_TIME_CONTEXT - Initialize the Context Area Used in Formatting Dates and Times for Input or Output


Format:
    context = vms_lib.init_date_time_context \
                  (user-context, component, init-string)
Returns:
context
Updated 'user-context' argument.
Arguments:
user-context
User context for repeated calls to INIT_DATE_TIME_CONTEXT - Python integer. WARNING! An invalid context value can result in an OpenVMS SS$_ROPRAND exception!
component
The component to be initialized. Constants like LIB_K_MONTH_NAME are available in module vms_libdtdef.
init-string
The characters which are to be used in formatting dates and times for input or output.
Examples:
>>> import vms_lib
>>> import vms_libdtdef

>>> context = 0                  # initialize

>>> month_name = "|1|2|3|4|5|6|7|8|9|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_MONTH_NAME, month_name) 
Traceback (innermost last):
  File "<stdin>", line 2, in ?
vms_lib.error: (1410092, '%LIB-F-NUMELEMENTS, number of elements\
 incorrect for component')
>>>

>>> month_name = "|Januar|Februar|Maerz|April|Mai|Juni|" + \
...              "Juli|August|September|Oktober|November|Dezember|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_MONTH_NAME, month_name) 
>>>

>>> month_name = "|Jan|Feb|Mrz|Apr|Mai|Jun|" + \
...              "Jul|Aug|Sep|Okt|Nov|Dez|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_MONTH_NAME_ABB, month_name) 
>>>

>>> weekday_name = "|Montag|Dienstag|Mittwoch|Donnerstag|" + \
...                "Freitag|Samstag|Sonntag|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_WEEKDAY_NAME, weekday_name)
>>>

>>> weekday_name = "|Mo|Di|Mi|Do|Fr|Sa|So|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_WEEKDAY_NAME_ABB,
...               weekday_name)
>>>

>>> meridiem_id = "|Vormittag|Nachmittag|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_MERIDIEM_INDICATOR,
...               meridiem_id)
>>>

>>> language = "|Deutsch|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_LANGUAGE, language)
>>>

>>> relative_day_name = "|gestern|heute|morgen|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_RELATIVE_DAY_NAME,
...               relative_day_name)
>>>

>>> format = "|JJJJ|MM|TT|SS|MM|SS|HH| |MONAT|"
>>> context = vms_lib.init_date_time_context (context,
...               vms_libdtdef.LIB_K_FORMAT_MNEMONICS, format)
>>>


--- release this context

>>> context = vms_lib.free_date_time_context (context)
>>> print context
0
>>>

(go to: table of contents, index, list of vms_lib, prev: GET_USERS_LANGUAGE, next: LP_LINES)

25-JUL-1999 ZE.