Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  3 927

•  TDictionary Custom Sort  6 031

•  Fast Watermark Sources  5 821

•  3D Designer  8 641

•  Sik Screen Capture  6 153

•  Patch Maker  6 594

•  Айболит (remote control)  6 583

•  ListBox Drag & Drop  5 442

•  Доска для игры Реверси  95 376

•  Графические эффекты  6 796

•  Рисование по маске  5 967

•  Перетаскивание изображений  4 970

•  Canvas Drawing  5 343

•  Рисование Луны  5 070

•  Поворот изображения  4 608

•  Рисование стержней  3 266

•  Paint on Shape  2 507

•  Генератор кроссвордов  3 398

•  Головоломка Paletto  2 699

•  Теорема Монжа об окружностях  3 494

•  Пазл Numbrix  2 295

•  Заборы и коммивояжеры  2 985

•  Игра HIP  1 945

•  Игра Go (Го)  1 858

•  Симулятор лифта  2 208

•  Программа укладки плитки  1 931

•  Генератор лабиринта  2 369

•  Проверка числового ввода  2 055

•  HEX View  2 376

•  Физический маятник  2 010

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Как конвертировать RFC1123 в TDateTime



function RFC1123ToDateTime(Date: string): TDateTime;
var
  day, month, year: Integer;
  strMonth: string;
  Hour, Minute, Second: Integer;
begin
  try
    day := StrToInt(Copy(Date, 6, 2));
    strMonth := Copy(Date, 9, 3);
    if strMonth = 'Jan' then
      month := 1
    else if strMonth = 'Feb' then
      month := 2
    else if strMonth = 'Mar' then
      month := 3
    else if strMonth = 'Apr' then
      month := 4
    else if strMonth = 'May' then
      month := 5
    else if strMonth = 'Jun' then
      month := 6
    else if strMonth = 'Jul' then
      month := 7
    else if strMonth = 'Aug' then
      month := 8
    else if strMonth = 'Sep' then
      month := 9
    else if strMonth = 'Oct' then
      month := 10
    else if strMonth = 'Nov' then
      month := 11
    else if strMonth = 'Dec' then
      month := 12;
    year := StrToInt(Copy(Date, 13, 4));
    hour := StrToInt(Copy(Date, 18, 2));
    minute := StrToInt(Copy(Date, 21, 2));
    second := StrToInt(Copy(Date, 24, 2));
    Result := 0;
    Result := EncodeTime(hour, minute, second, 0);
    Result := Result + EncodeDate(year, month, day);
  except
    Result := now;
  end;
end;

function DateTimeToRFC1123(aDate: TDateTime): string;
const
  StrWeekDay: string = 'MonTueWedThuFriSatSun';
  StrMonth: string = 'JanFebMarAprMayJunJulAugSepOctNovDec';
var
  Year, Month, Day: Word;
  Hour, Min, Sec, MSec: Word;
  DayOfWeek: Word;
begin
  DecodeDate(aDate, Year, Month, Day);
  DecodeTime(aDate, Hour, Min, Sec, MSec);
  DayOfWeek := ((Trunc(aDate) - 2) mod 7);
  Result := Copy(StrWeekDay, 1 + DayOfWeek * 3, 3) + ', ' +
    Format('%2.2d %s %4.4d %2.2d:%2.2d:%2.2d',
    [Day, Copy(StrMonth, 1 + 3 * (Month - 1), 3),
    Year, Hour, Min, Sec]);
end;







Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте