| 214 | } |
| 215 | |
| 216 | IntVal TimestampFunctions::DayOfWeek(FunctionContext* context, |
| 217 | const TimestampVal& ts_val) { |
| 218 | if (ts_val.is_null) return IntVal::null(); |
| 219 | const TimestampValue& ts_value = TimestampValue::FromTimestampVal(ts_val); |
| 220 | if (!ts_value.HasDate()) return IntVal::null(); |
| 221 | // Sql has the result in [1,7] where 1 = Sunday. Boost has 0 = Sunday. |
| 222 | return IntVal(ts_value.date().day_of_week() + 1); |
| 223 | } |
| 224 | |
| 225 | IntVal TimestampFunctions::DayOfMonth(FunctionContext* context, |
| 226 | const TimestampVal& ts_val) { |