部分代碼:
testdate>=to_date(:ST,"YYYYMMDD") and testdate<to_date(:FT,"YYYYMMDD")
parambyname('ST').AsString :=formatdatetime('yyyymmdd',datetimepicker1.Date)
parambyname('FT').AsString :=formatdatetime('yyyymmdd',datetimepicker1.Date+10/24)
麻煩看一下哪里錯了?好像是加不了10/24的樣子,加1就可以好像?
uj5u.com熱心網友回復:
看一下這幾個函式IncDay Returns a date shifted by a specified number of days.
IncHour Returns a date/time value shifted by a specified number of hours.
IncMilliSecond Returns a date/time value shifted by a specified number of milliseconds.
IncMinute Returns a date/time value shifted by a specified number of minutes.
IncSecond Returns a date/time value shifted by a specified number of seconds.
IncWeek Returns a date shifted by a specified number of weeks.
IncYear Returns a date shifted by a specified number of years.
要Uses DateUtils
uj5u.com熱心網友回復:
TDatetime實際是double型別,應該是可以加10/24的,不知道你這里的10/24是表示什么uj5u.com熱心網友回復:
代表datetimepicker1+1/24*10,奇怪的是一直都不行,加1天都可以,加10個小時就不行?uj5u.com熱心網友回復:
1、TDatetime實際是double型別,可以加10/24。2、+10/24是加長10小時。
3、雖然你加長10小時,但是如果不能進1的話,formatdatetime('yyyymmdd',datetimepicker1.Date+10/24)的值還是原值。
建議你使用:formatdatetime('yyyymmdd hh',datetimepicker1.Date+10/24),顯示(加)小時字符,看看你是否加入了10/24。
uj5u.com熱心網友回復:
另外,如果你計算天數,另外小時數,算1天的話,你可以通過代碼實作:formatdatetime('yyyymmdd hh',Round(datetimepicker1.Date+10/24));
uj5u.com熱心網友回復:
formatdatetime('yyyymmdd',Round(datetimepicker1.Date+10/24));uj5u.com熱心網友回復:
建議用DateUtils里的函式,很多很全轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/81137.html
標籤:語言基礎/算法/系統設計
上一篇:幫忙推薦一個控制元件
下一篇:請問delphi有沒有這樣的組件
