---------------------------------------------------------------------
whereSql := ‘substr(f_billNumber,1,4)=‘ + QuotedStr(yymm)
else
whereSql := ‘left(f_billNumber,4)=‘ + QuotedStr(yymm);
---------------------------------------------------------------------
near syntax error
insert into [t_Table] ([fName]) select ‘张三‘
where not exists (SELECT 1 FROM [t_Table] where [fName] = ‘张三‘);
insert into ErrorConfig(Type,Value1)
select ‘RetryWaitSeconds‘,‘3‘
where not exists(select * from ErrorConfig where Type=‘RetryWaitSeconds‘)
\
计算机当前时间
SELECT date(‘now’)
计算机当前月份的最后一天
SELECT date(‘now’,’start of month’,’+1 month’,’-1 day’)
计算UNIX 时间戳1092941466表示的日期和时间
SELECT datetime(‘1092941466’,’unixepoch’)
计算 UNIX 时间戳1092941466 表示的本地日期和时间
SELECT datetime(‘1092941466’,’unixepoch’,’localtime’)
计算机当前UNIX 时间戳
SELECT strftime(‘%s’,’now’)
两个日期之间相差多少天
SELECT jolianday(‘now’)-jolianday(‘1981-12-23’)
两个日期时间之间相差多少秒
SELECT julianday(‘now‘)*86400 - julianday(‘2004-01-01 02:34:56‘)*86400
计算今年十月份第一个星期二的日期
SELECT date(‘now‘,‘start of year‘,‘+9 months‘,‘weekday 2‘);
||字符串相加
delphi 日期时间相差 (2013-12-09 06:12:14)转载▼
标签: delphi it 分类: 开发资源
uses
DateUtils
function YearsBetween(const ANow, AThen: TDateTime): Integer; //年差
function MonthsBetween(const ANow, AThen: TDateTime): Integer;//月差
function WeeksBetween(const ANow, AThen: TDateTime): Integer;//星期差
function DaysBetween(const ANow, AThen: TDateTime): Integer;//日差
function HoursBetween(const ANow, AThen: TDateTime): Int64;//小时差
function MinutesBetween(const ANow, AThen: TDateTime): Int64;//分钟差
function SecondsBetween(const ANow, AThen: TDateTime): Int64;//秒差
function MilliSecondsBetween(const ANow, AThen: TDateTime): Int64; //豪秒差 1000进制
function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer = 1): TDateTime; //年相加减
function IncWeek(const AValue: TDateTime;const ANumberOfWeeks: Integer = 1): TDateTime; //月相加减
function IncDay(const AValue: TDateTime;const ANumberOfDays: Integer = 1): TDateTime; //日相加减
function IncHour(const AValue: TDateTime;const ANumberOfHours: Int64 = 1): TDateTime; //小时相加减
function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64 = 1): TDateTime; //分钟相加减
function IncSecond(const AValue: TDateTime;const ANumberOfSeconds: Int64 = 1): TDateTime; //秒相加减
function IncMilliSecond(const AValue: TDateTime;const ANumberOfMilliSeconds: Int64 = 1): TDateTime; //毫秒相加减
详细请看
DateUtils 里面封装了很多日期时间函数
原文地址:https://www.cnblogs.com/xionda/p/12262834.html