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

Вниз

Проблема с временем   Найти похожие ветки 

 
Volf_555   (2005-09-30 22:42) [0]

Кода я пишу TimeToStr(Time), то время выводится в формате:
hh:mm:ss
Как сделать так, чтобы время выводилось в формате:
hh:mm


 
Adder ©   (2005-09-30 23:03) [1]

F1 TimeToStr + Currency and date/time formatting variables

LongTimeFormat:="hh:mm";


 
werewolf_   (2005-09-30 23:04) [2]

Naprimer tak

procedure TForm1.Button1Click(Sender: TObject);
var
 F: TFormatSettings;
begin
 F.ShortDateFormat:="mm dd";
 Button1.Caption:=TimeToStr(Now, F);
end;


 
Volf_555   (2005-09-30 23:08) [3]

А какой подключить модуль для работы программы с TFormatSettings?


 
faeton   (2005-10-01 00:14) [4]

можно еще так:
time:=format("hh:mm",now); //time- переменная типа string


 
WereWolf_   (2005-10-01 00:46) [5]

Unit

SysUtils

Delphi syntax:

type

 TFormatSettings = record
   CurrencyFormat: Byte;
   NegCurrFormat: Byte;
   ThousandSeparator: Char;
   DecimalSeparator: Char;
   CurrencyDecimals: Byte;
   DateSeparator: Char;
   TimeSeparator: Char;
   ListSeparator: Char;
   CurrencyString: string;
   ShortDateFormat: string;
   LongDateFormat: string;
   TimeAMString: string;
   TimePMString: string;
   ShortTimeFormat: string;
   LongTimeFormat: string;

   ShortMonthNames: array[1..12] of string;
   LongMonthNames: array[1..12] of string;
   ShortDayNames: array[1..7] of string;
   LongDayNames: array[1..7] of string;
   TwoDigitYearCenturyWindow: Word;
 end;

Description

TFormatSettings defines a data structure containing locale information used by string formatting routine. Each member of TFormatSettings is equivalent to the global variable with the same name. A variable of type TFormatSettings defines a thread-safe context that formatting functions can use in place of the default global context, which is not thread-safe.

To create and use the thread-safe environment defined by TFormatSettings, follow these steps:

Define a variable of type TFormatSettings
Call GetLocaleFormatSettings to populate the TFormatSettings variable with locale information.
Pass the TFormatSettings variable as the last parameter of the string formatting routine.

Each routine that accepts a TFormatSettings parameter is thread-safe, and is an overload of an equivalent function that refers to the global formatting variables.


 
Германн ©   (2005-10-01 02:48) [6]

Имхо, FormatDateTime - самый универсальный способ реализации сабжа.
Менять походя в программе форматы по умолчанию, по-моему moveton.



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

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

Наверх





Память: 0.46 MB
Время: 0.044 c
14-1127908554
NailMan
2005-09-28 15:55
2005.10.23
А Вирт-то почти наш(авиамоделисткий) человек!


1-1127836971
Суслик
2005-09-27 20:02
2005.10.23
Вопрос про csOpaque


4-1124052380
Overrider
2005-08-15 00:46
2005.10.23
Дозвон до провайдера.


14-1128078838
Delphin
2005-09-30 15:13
2005.10.23
Как позвонить?


4-1124613303
Андрей Молчанов
2005-08-21 12:35
2005.10.23
WM_QUERYENDSESSION





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