Date/Time 問題 |
尚未結案
|
tidal
初階會員 發表:93 回覆:32 積分:25 註冊:2003-07-15 發送簡訊給我 |
|
epl
一般會員 發表:5 回覆:9 積分:2 註冊:2003-02-19 發送簡訊給我 |
|
wameng
版主 發表:31 回覆:1336 積分:1188 註冊:2004-09-16 發送簡訊給我 |
|
jimmy_wei
高階會員 發表:9 回覆:176 積分:147 註冊:2003-08-28 發送簡訊給我 |
|
mflyy
初階會員 發表:3 回覆:44 積分:44 註冊:2002-08-13 發送簡訊給我 |
Hello tidal :
如果你是想傳字串型態為參數值用以下寫法比較符合你的要求 select * from card
where CONVERT(char(10),YourDateTime,111) > '2004/9/21'
先將DateTime Field 內的資料轉成 char 即可 !! 如果使用datetime 型態,你要注意你的data內是否有時間的資料
單純去使用 datetime >'2004/9/21' 可能會出現不是你要的資料內容
因為時間也會被拿出來比較的
|
ha0009
版主 發表:16 回覆:507 積分:639 註冊:2002-03-16 發送簡訊給我 |
|
cashxin2002
版主 發表:231 回覆:2555 積分:1937 註冊:2003-03-28 發送簡訊給我 |
|
andychang1690
資深會員 發表:20 回覆:694 積分:442 註冊:2003-03-14 發送簡訊給我 |
跟隨cashxin2002版大一起插花!ha0009版大是正解,若程式要移植到
其他資料庫又如何?
我曾經回答過http://delphi.ktop.com.tw/topic.php?TOPIC_ID=56185
【問題】找尋日期問題
答題得分者為:andychang1690
中是如此說的:
我先說我個人經驗,從Dos起我寫過的程式於大陸、東南亞、
美國、歐洲都有!面臨各國的日期環境說真的我被逼瘋了!後來我全部用
字串處理!統一一個格式yyyymmdd如此程式內的輸入我是使用日期格式
管你是怎麼格式我只要使用FormatString就可以了!
提供參考! Andy Chang
------
Andy Chang |
tidal
初階會員 發表:93 回覆:32 積分:25 註冊:2003-07-15 發送簡訊給我 |
|
andychang1690
資深會員 發表:20 回覆:694 積分:442 註冊:2003-03-14 發送簡訊給我 |
tidal:一般SQL都可引用 ' ,除了Access,請用KTop搜尋,關鍵字:datetime mssql。
查詢關鍵字:datetime mssql (64 61 74 65 74 69 6D 65 20 6D 73 73 71 6C ,datetime mssql) 本次查詢共找到34筆
其中這篇:
http://delphi.ktop.com.tw/topic.php?topic_id=53453
【Delphi】【問題】SQL 問題請教(日期時間轉換成浮點數)?
答題得分者為:timhuang
cherry 結論中提到:
感謝timhuang...
原來是這樣
我瞭解了... 我整理如下, 希望可以供其它人參考 :)
如果以浮點數來處理時間
=================================================
delphi的基準點是 1899/12/30
mssql 的 基準點是 1900/1/1
Access的基準點是 1899/12/30
=================================================
如果以字串來處理時間
必須注意各資料庫的用法
=================================================
Access 有專用的符號#
select * from dz_main where logtime > #2003/07/30#
=================================================
Cherry
請參考! Andy Chang
------
Andy Chang |
bennykyp
一般會員 發表:11 回覆:31 積分:8 註冊:2004-10-21 發送簡訊給我 |
|
bennykyp
一般會員 發表:11 回覆:31 積分:8 註冊:2004-10-21 發送簡訊給我 |
Sorry for the Error displaying word.
excually I'm using the English OS, but don't know why I type the chinese word come out the error. And what did I am saying before.
In the Interbase , when we using this SQL statement
'select * from card where datetime > #2004/9/21#' I heard about it , this statement also cannot run in Interbase,
If upgrade the ODBC version in window 2000 to the higher version , it should be can soft the problem. but in Window XP, I also heard about it that is not the problem. I didn't try it properly. I need all of yours reply.
Thanks
|
bigdogchina
版主 發表:238 回覆:523 積分:312 註冊:2003-04-28 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |