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

Вниз

функция StrToDate и формат времени.   Найти похожие ветки 

 
Gear   (2006-04-03 13:25) [0]

Добрый день! Как можно сделать так чтобы функция StrToDate брала определённый формат, например "03.04.2006" и не ругалась, даже если в системе установлен формат, например 03/04/2006? Спасибо.


 
vovnuke ©   (2006-04-03 13:28) [1]

попробуй передать туда свой FormatSettings;


 
balepa ©   (2006-04-03 13:28) [2]

Converts a string to a TDateTime value.
Unit
SysUtils
Category
datetime routines
Delphi syntax:
function StrToDate(const S: string): TDateTime; overload;
function StrToDate(const S: string; const FormatSettings: TFormatSettings): TDateTime; overload;
C++ syntax:
extern PACKAGE System::TDateTime __fastcall StrToDate(const AnsiString S);
extern PACKAGE System::TDateTime __fastcall StrToDate(const AnsiString S, const TFormatSettings FormatSettings);

Description
Call StrToDate to parse a string that specifies a date. If S does not contain a valid date, StrToDate raises an EConvertError exception.
S must consist of two or three numbers, separated by the character defined by the DateSeparator global variable or its TFormatSettings equivalent. The order for month, day, and year is determined by the ShortDateFormat global variable or its TFormatSettings equivalent--possible combinations are m/d/y, d/m/y, and y/m/d.

If S contains only two numbers, it is interpreted as a date (m/d or d/m) in the current year.
Year values between 0 and 99 are converted using the TwoDigitYearCenturyWindow. This value is stored either in a global variable (first form) or as a field in the FormatSettings parameter (second form) See "Currency and Date-Time Formatting Variables" for more information.
The first form of StrToDate is not thread-safe, because it uses localization information contained in global variables. The second form of StrToDate, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of StrToDate, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings.



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

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

Наверх





Память: 0.45 MB
Время: 0.011 c
2-1145105032
Keks
2006-04-15 16:43
2006.05.07
Создание всплывающего сообщения


15-1144769258
chizra
2006-04-11 19:27
2006.05.07
Как пользоваться программой tar.exe для распаковки...


2-1145373905
ctudent
2006-04-18 19:25
2006.05.07
DCU


4-1139840897
AversFm
2006-02-13 17:28
2006.05.07
Ув. мастера, помогите разобраться с сервисом - жрет 100% процессо


2-1145365284
ZZZ_ZZZ
2006-04-18 17:01
2006.05.07
Формат веществ. чисел





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский