bestlong 怕失憶論壇

 

 

搜索
bestlong 怕失憶論壇 論壇 Database - 資料庫 MySQL MySQL 之日期處理篇
查看: 6068|回復: 0
go

MySQL 之日期處理篇 [複製鏈接]

Rank: 9Rank: 9Rank: 9

1#
發表於 2006-9-26 09:49 |只看該作者 |倒序瀏覽 |打印
若是日期資料是用字串方式儲存 YYYYMMDDHHmmss 的格式,可以用 str_to_date() 函數來轉換
  1. mysql> select str_to_date('20030120223050' , '%Y%m%d%H%i%s'), UNIX_TIMESTAMP(str_to_date('20030120223050' , '%Y%m%d%H%i%s')) \G
  2. *************************** 1. row ***************************
  3.                 str_to_date('20030120223050' , '%Y%m%d%H%i%s'): 2003-01-20 22:30:50
  4. UNIX_TIMESTAMP(str_to_date('20030120223050' , '%Y%m%d%H%i%s')): 1043073050
複製代碼
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw
‹ 上一主題|下一主題

Archiver|怕失憶論壇

GMT+8, 2024-4-25 01:09 , Processed in 0.010050 second(s), 11 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.