Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.01.20;
Скачать: [xml.tar.bz2];

Вниз

Как узнать какой формат даты используется в Виндах?   Найти похожие ветки 

 
Goida   (2004-01-08 17:38) [0]

Мне нужно сделать программу, которая бы сама узнавала формат даты в Виндах и использовала бы правильный разделитель и правильную последовательность мм дд гг и т.п. Есть какой нибудь способ узнать эти настройки?


 
Тимохов   (2004-01-08 17:40) [1]

influence the way numeric or date/time values are formatted.

Unit

SysUtils

The following are a set of variables used to define the format for numeric or date/time strings:

var CurrencyString: string;
var CurrencyFormat: Byte;
var NegCurrFormat: Byte;
var ThousandSeparator: Char;
var DecimalSeparator: Char;
var CurrencyDecimals: Byte;
var DateSeparator: Char;
var ShortDateFormat: string;
var LongDateFormat: string;
var TimeSeparator: Char;
var TimeAMString: string;
var TimePMString: string;
var ShortTimeFormat: string;

var LongTimeFormat: string;
var ShortMonthNames: array[1..12] of string;
var LongMonthNames: array[1..12] of string;
var ShortDayNames: array[1..7] of string;
var LongDayNames: array[1..7] of string;

var SysLocale: TSysLocale;
var EraNames: array[1..7] of string;
var EraYearOffsets: array[1..7] of Integer;
var TwoDigitYearCenturyWindow: Word = 50;

var TListSeparator: Char;

Description

The SysUtils unit includes a number of variables that are used by various formatting routines. Values are assigned to these variables to define the formats of numeric and date/time strings. The initial values of these variables are fetched from the system registry using the GetLocaleInfo function in the Win32 API. VCL (non-console) applications automatically update these formatting variables in response to WM_WININICHANGE messages. The Application variable’s UpdateFormatSettings method either allows or disallows changes in system settings. The default is True. Set this property to False to prevent the system settings from changing.

The description of each variable specifies the LOCALE_XXXX constant used to fetch the value .

Typed constant Defines

CurrencyString CurrencyString defines the currency symbol (or characters) used in floating-point to decimal conversions. The initial value is fetched from LOCALE_SCURRENCY.
CurrencyFormat CurrencyFormat defines the currency symbol placement and separation used in floating-point–to–decimal conversions. Possible values are:
0 = $1
1 = 1$
2 = $ 1
3 = 1 $
The initial value is fetched from LOCALE_ICURRENCY.
NegCurrFormat NegCurrFormat defines the currency format used in floating-point to decimal conversions of negative numbers. Possible values are:
0 = ($1) 4 = (1$) 8 = -1 $ 12 = $ -1
1 = -$1 5 = -1$ 9 = -$ 1 13 = 1- $
2 = $-1 6 = 1-$ 10 = 1 $- 14 = ($ 1)
3 = $1- 7 = 1$- 11 = $ 1- 15 = (1 $)
The initial value is fetched from LOCALE_INEGCURR.

ThousandSeparator ThousandSeparator is the character used to separate thousands in numbers with more than three digits to the left of the decimal separator. A value of #0 indicates that no thousand separator character should be output, even if the format string specifies it. The initial value is fetched from LOCALE_STHOUSAND.
DecimalSeparator DecimalSeparator is the character used to separate the integer part from the fractional part of a number. This variable must have a value other than #0. The initial value is fetched from LOCALE_SDECIMAL.

CurrencyDecimals CurrencyDecimals is the number of digits to the right of the decimal point in a currency amount. The initial value is fetched from LOCALE_ICURRDIGITS.
DateSeparator DateSeparator is the character used to separate the year, month, and day parts of a date value. The initial value is fetched from LOCATE_SDATE.
ShortDateFormat ShortDateFormat is the format string used to convert a date value to a short string suitable for editing. For a complete description of date and time format strings, see Date-Time format strings. The short date format should only use the date separator character and the m, mm, d, dd, yy, and yyyy format specifiers. The initial value is fetched from LOCALE_SSHORTDATE.

LongDateFormat LongDateFormat is the format string used to convert a date value to a long string suitable for display but not for editing. For a complete description of date and time format strings, see Date-Time format strings. The initial value is fetched from LOCALE_SLONGDATE.
TimeSeparator TimeSeparator is the character used to separate the hour, minute, and second parts of a time value. The initial value is fetched from LOCALE_STIME.

TimeAMString TimeAMString is the suffix string used for time values between 00:00 and 11:59 in 12-hour clock format. The initial value is fetched from LOCALE_S1159.
TimePMString TimePMString is the suffix string used for time values between 12:00 and 23:59 in 12-hour clock format. The initial value is fetched from LOCALE_S2359.
ShortTimeFormat ShortTimeFormat is the format string used to convert a time value to a short string with only hours and minutes. The default value is computed from LOCALE_ITIME and LOCALE_ITLZERO.

LongTimeFormat LongTimeFormat is the format string used to convert a time value to a long string with hours, minutes, and seconds. The default value is computed from LOCALE_ITIME and LOCALE_ITLZERO.
ShortMonthNames ShortMonthNames is the array of strings containing short month names. The mmm format specifier in a format string passed to FormatDateTime causes a short month name to be substituted. The default values are fetched from the LOCALE_SABBREVMONTHNAME system locale entries.

LongMonthNames LongMonthNames is the array of strings containing long month names. The mmmm format specifier in a format string passed to FormatDateTime causes a long month name to be substituted. The default values are fetched from the LOCALE_SMONTHNAME system locale entries.
ShortDayNames ShortDayNames is the array of strings containing short day names. The ddd format specifier in a format string passed to FormatDateTime causes a short day name to be substituted. The default values are fetched from the LOCALE_SABBREVDAYNAME system locale entries.

LongDayNames LongDayNames is the array of strings containing long day names. The dddd format specifier in a format string passed to FormatDateTime causes a long day name to be substituted. The default values are fetched from the LOCALE_SDAYNAME system locale entries.
SysLocale Indicates the locale used by FormatDateTime to interpret dates.
EraName Controls the DateTimeToStr function (for East Asian locales).

EraYearOffsets Controls the DateTimeToStr function (for East Asian locales).
TwoDigitYearCenturyWindow Determines what century is added to two-digit years when string dates are converted to numeric dates with StrToDate or StrToDateTime. The value of TwoDigitYearCenturyWindow, if it is nonzero, is subtracted from the current year to calculate the floating “pivot” prior to which two-digit years are interpreted as falling in the next century. The default value is 50. You can use TwoDigitYearCenturyWindow to extend the life of legacy applications that are tied to two-digit-year data entry; but the best solution is to require four-digit input for years.

ListSeparator The character used to separate items in a list. The default value is fetched from LOCALE_SLIST.


 
Ega23   (2004-01-08 17:43) [2]

Класс! Грамотный и развёрнутый ответ. Уважение.


 
Тимохов   (2004-01-08 17:46) [3]

Вот только думаю, что модератор будет не доволен.

В следующий раз кто-нить на вопрос "как сделать так, чтобы в мой файл никто не мог ничего записать пока я в него пишу" будет давать страниц 300 из MSDN...


 
Ega23   (2004-01-08 17:50) [4]

Вообще-то верно.


 
sniknik   (2004-01-08 18:34) [5]

хелр переписывать, ни разу не правильно. достаточно было бы DateSeparator + F1.


 
Тимохов   (2004-01-08 18:36) [6]

sniknik © (08.01.04 18:34) [5]
Ты часто видел, чтобы после совета "<ключевое слово>+f1" вопросы отападали? Кусок хелпа - самое надежное дело имхо.


 
app   (2004-01-08 18:48) [7]

Тимохов © (08.01.04 17:46) [3]
Уже не доволен, нет необхоимости перепечатывать статью из справки, которая есть у него самого, хватило бы ссылки на статью.
И не ссылки на "вопросы отападали", вопросы по непонятным местам справки дело святое, а делать полное копирование темы сжда это плохо. Во всем надо чувство меры.


 
Тимохов   (2004-01-08 18:52) [8]

Приношу свои извинения...
Больше не повториться...



Страницы: 1 вся ветка

Форум: "Основная";
Текущий архив: 2004.01.20;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.48 MB
Время: 0.01 c
1-63185
Zheks
2004-01-10 11:43
2004.01.20
Mutex


3-62974
MixerPro
2003-12-19 11:54
2004.01.20
Залипание после запросов.


14-63401
ИМХО
2003-12-27 20:02
2004.01.20
Футбол. Англия. Премьер-Лига. Трудоголики.


1-63246
Вованчик
2004-01-09 09:38
2004.01.20
Hint


6-63285
Mag
2003-11-17 19:37
2004.01.20
Отправка содержимого формы по Майлу





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский