Informix資料庫中的TO DATE函式

2022-03-26 01:27:36 字數 675 閱讀 2925

to_date函式將字串轉換成 datetime 值。這個函式根據format_string引數指定的格式,把char_expression引數評估為日期,並返回等價的日期值。如果char_expression為 null,那麼將返回 null 值。

to_date函式的任何引數必須是內建資料型別。

如果省略format_string引數,那麼to_date函式會對 datetime 值應用預設 datetime 格式。預設 datetime 格式由 gl_datetime 環境變數指定.

格式:to_date('20031231030112','%y%m%d%h%m%s')

例子:select * from table  where t01 =to_date('20091201','%y%m%d')

to_char函式的select語句來執行此轉換:

select to_char(begin_date, '%a %b %d, %y %r') from tab1;

在這個例子裡面format_string引數中的符號具有下列含義。

符號含義

%a語言環境中定義的完整weekday名

%b語言環境中定義的完整月份名

%d用十進位制數表示的每個月的日期

%y用4位十進位制數表示的年份

%r24小時表示法的時間

informix資料庫分頁

需求描述 當查詢結果返回大量資料情況下,比如報表查詢。需要按一定條件排序提供分頁呈現資料。informix實現方案 informix 資料庫提供了非常便捷 高效的sql。select skip m first n from tablename where 1 1 order bycol sql應用舉...

Informix資料庫檢視資料庫大小

檢視資料庫空間,不看清單 select dbsname,count num of extents,sum pe size from sysmaster systabnames,sysmaster sysptnext where partnum pe partnum and dbsname dbnam...

INFORMIX資料庫系統

7.4.3 informix資料庫系統 informix系統使用了兩類日誌檔案 邏輯日誌檔案 logical log file 和物理日誌檔案 physical log file 邏輯日誌檔案用來存放資料庫系統中所有更新事務的日誌資訊,就是我們這一章所講的資料庫日誌 物理日誌檔案並不存放日誌資訊,它...