Delphi两则:1、PDT时间转北京时间,2、条件编译
来源:互联网 发布:linux服务器防火墙设置 编辑:程序博客网 时间:2024/06/13 12:26
1、PDT时间转北京时间
做了个小东西,时间是PDT,而且月份也是英文的。写了个小函数,有用得着的直接copy去:)
有更好的实现方法,请回复。
2、关于条件编译:
如果你希望使用命令行dcc32.exe编译工程,请cd到dpr所在目录,否则条件变量可能无法生效(至少我{$I xxx.inc}进来的无效。
做了个小东西,时间是PDT,而且月份也是英文的。写了个小函数,有用得着的直接copy去:)
有更好的实现方法,请回复。
- uses DateUtils;
- function ConvertPDTDateTime(Str: string): TDateTime;
- const
- EngMonthName: array[1..12] of string = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
- var
- I: Integer;
- fs: TFormatSettings;
- begin
- fs.ShortDateFormat := 'mm-dd-yy';
- fs.LongDateFormat := 'mm-dd-yyyyy';
- fs.DateSeparator := '-';
- fs.TimeSeparator := ':';
- fs.LongTimeFormat := 'hh:nn:ss';
- fs.ShortTimeFormat := 'hh:nn:ss';
- fs.TwoDigitYearCenturyWindow := 50;
- for I := 1 to 12 do
- begin
- Str := StringReplace(Str, EngMonthName[I], IntToStr(I), [rfIgnoreCase]);
- end;
- Result := StrToDateTime(Str, fs);
- //PDT是Pacific Daylight Time的简称,意思是太平洋夏令时
- //指的是美国西部时间
- //-8区 和北京平时差16小时 4-10月夏令时差15小时
- if Pos('PDT', Str) > 0 then
- begin
- if MonthOf(Result) in [4..10] then
- Result := IncHour(Result, 15)
- else
- Result := IncHour(Result, 16);
- end;
- end;
2、关于条件编译:
如果你希望使用命令行dcc32.exe编译工程,请cd到dpr所在目录,否则条件变量可能无法生效(至少我{$I xxx.inc}进来的无效。
- Delphi两则:1、PDT时间转北京时间,2、条件编译
- delphi条件编译
- Delphi:条件编译
- Delphi 条件编译
- delphi 获取北京时间
- PHP时间戳、时间戳转北京时间日期
- UTC时间与北京时间
- Delphi各版本号,条件编译有用
- Delphi各版本号,条件编译有用
- Delphi版本号对照(条件编译中用到)
- linux格林时间和北京时间
- 输出UTC时间和北京时间
- 输出UTC时间和北京时间
- 同步centos时间为北京时间
- Python时间戳转为北京时间
- 获得时间戳转为北京时间
- 关于条件编译的两种格式
- PDT
- CoreChannel
- VS2005Ajax安装指南.doc
- inotify例程
- Linux命令之sudo简单理解
- 盗版系统避免10月20号后出现黑屏的方法
- Delphi两则:1、PDT时间转北京时间,2、条件编译
- 低沉中。。。
- My Ubuntu free CD Shipped/Cancelled requests list:
- 新手
- “windows workflow foundation 新一代工作流开发实务” 读后感
- 一个数据库简易浏览功能的实现
- jdk引入第三方jar
- 技术收集
- UNIX基础知识常用UNIX命令