Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.01.09;
Скачать: CL | DM;

Вниз

Дата.   Найти похожие ветки 

 
Andy BitOff ©   (2004-12-23 18:52) [0]

Как из сторки:

var
 m,y:string;
begin
 m:="Ноябрь";
 y:="2004";
end;

Получить TDateTime?


 
Ega23 ©   (2004-12-23 18:56) [1]

А что считать TdateTime?
38288 или 38259? (01.10.2004 и 30.10.2004)


 
Andy BitOff ©   (2004-12-23 19:12) [2]

Всеравно. Это только месяц и соответственно любое число месяца. Это не принципиально.


 
Anatoly Podgoretsky ©   (2004-12-23 19:20) [3]

Преобразуй строки в число и EncodeDate


 
Ega23 ©   (2004-12-23 19:24) [4]


function YearAndMonthToDateTime(const aYear, aMonth :String):TDateTime;
function StrMonthToInt(aStr:String):Integer;
begin
 if (Str="ЯНВАРЬ") then result:=1
 else
 if (Str="ФЕВРАЛЬ") then result:=2
 else
 if (Str="МАРТ") then result:=3
 else
 if (Str="АПРЕЛЬ") then result:=4
 else
 if (Str="МАЙ") then result:=5
 else
 if (Str="ИЮНЬ") then result:=6
 else
 if (Str="ИЮЛЬ") then result:=7
 else
 if (Str="АВГУСТ") then result:=8
 else
 if (Str="СЕНТЯБРЬ") then result:=9
 else
 if (Str="ОКТЯБРЬ") then result:=10
 else
 if (Str="НОЯБРЬ") then result:=11
 else
 if (Str="ДЕКАБРЬ") then result:=12
 else Result:=0;
end;

var
MonthStr:String;
Month, Year:Word;
Code:Integer;
begin
Result:=0;
MonthStr:=Trim(ANSIUpperCase(aMonth));
Val(aYear, Year, Code);
if Code<>0 then Exit;
Month:=StrMonthToInt(MonthStr);
if Month=0 then Exit;
Result:=EncodeDate(Year, Month, 1);
end;


Писал прямо здесь, возможны ошибки. Хотя, вроде, всё верно...



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

Текущий архив: 2005.01.09;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.046 c
3-1102496556
chum
2004-12-08 12:02
2005.01.09
Использование Ado


14-1103388402
alex145
2004-12-18 19:46
2005.01.09
PHP-скрипт без ответа


1-1103613755
Ander
2004-12-21 10:22
2005.01.09
Верхний индекс в Memo


6-1098093599
Zelius
2004-10-18 13:59
2005.01.09
Проблемы с TidHttpserver.MaxConnections в Indy 9


1-1103551540
torch
2004-12-20 17:05
2005.01.09
file not found (somefile.dcu)