- Query裡下日期條件
SELECT * FROM `Record`
WHERE YEAR(`RecordDate`) = '2009'
AND MONTH(`RecordDate`) = '9' - 加減日期時間
問:取出RecordDate欄位,並加上480分鐘(UTC TimeZone)
MySQL
//add 480 mins
Select DATE_ADD(RecordDate ,INTERVAL 480 MINUTE) as RecordDate From ...
//substract 30 days
`UpdateTime` Between DATE_SUB(NOW() ,INTERVAL 30 DAY) And NOW()
Access
Select dateadd("n",480,RecordDate) as RecordDate From ...
yyyy Year
q Quarter
m Month
y Day of the year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
Access: DateAdd Function
沒有留言:
張貼留言