系统开发总结,站长工具seo综合查询怎么用,区块链交易网站开发,私密浏览器免费看片在线看文章目录 相关文献常量#xff1a;当前日期、时间戳前一天日期、后一天日期获取日期中的年、季度、月、周、日、小时、分、秒等时间戳转换时间戳 to 日期日期 to 时间戳 日期之间月、天数差 作者#xff1a;小猪快跑 基础数学计算数学#xff0c;从事优化领域5年#… 文章目录 相关文献常量当前日期、时间戳前一天日期、后一天日期获取日期中的年、季度、月、周、日、小时、分、秒等时间戳转换时间戳 to 日期日期 to 时间戳 日期之间月、天数差 作者小猪快跑 基础数学计算数学从事优化领域5年主要研究方向MIP求解器、整数规划、随机规划、智能优化算法。
如有错误欢迎指正。如有更好的算法也欢迎交流——小猪快跑
相关文献
LanguageManual UDF - Apache Hive - Apache Software Foundation
常量当前日期、时间戳
返回类型名称样例描述datecurrent_datecurrent_date 2024-01-01返回查询评估开始时的当前日期从 Hive 1.2.0 开始。同一查询中的所有current_date调用都返回相同的值。timestampcurrent_timestampcurrent_timestamp 2024-01-01 00:00:00返回查询评估开始时的当前时间戳从 Hive 1.2.0 开始。同一查询中的所有current_date调用都返回相同的值。
前一天日期、后一天日期
返回类型名称样例pre 2.1.0: string 2.1.0 on: datedate_add(date/timestamp/string startdate, tinyint/smallint/int days)date_add(‘2008-12-31’, 1) 2009-01-01pre 2.1.0: string 2.1.0 on: datedate_sub(date/timestamp/string startdate, tinyint/smallint/int days)date_sub(‘2008-12-31’, 1) 2008-12-30
date_sub(current_date, 1) -- 昨天
date_add(current_date, 1) -- 明天获取日期中的年、季度、月、周、日、小时、分、秒等
返回类型名称样例描述intyear(string date)year(1970-01-01) 1970年year(1970-01-01 00:00:00) 1970intquarter(date/timestamp/string)quarter(2015-04-08) 2季度intmonth(string date)month(1970-11-01 00:00:00) 11月month(1970-11-01) 11intweekofyear(string date)weekofyear(1970-11-01 00:00:00) 44周weekofyear(1970-11-01) 44intday(string date) dayofmonth(date)day(1970-11-01 00:00:00) 1日day(1970-11-01) 1inthour(string date)hour(2009-07-30 12:58:59) 12小时hour(12:58:59) 12intminute(string date)分intsecond(string date)秒stringlast_day(string date)last_day(2015-01-14) 2015-01-31当月最后一天stringnext_day(string start_date, string day_of_week)next_day(2015-01-14, TU) 2015-01-20给定日期后最近的星期几
时间戳转换
时间戳 to 日期
返回类型名称样例描述stringfrom_unixtime(bigint unixtime[, string pattern])from_unixtime(0)1970-01-01 00:00:001970-01-01 00:00:00 UTC之后多少秒的时间注意不同时区结果不同
日期 to 时间戳
返回类型名称样例描述bigintunix_timestamp(string date)unix_timestamp(‘2009-03-20 11:30:01’) 12375738011970-01-01 00:00:00 UTC之后多少秒注意不同时区结果不同bigintunix_timestamp(string date, string pattern)unix_timestamp(‘2009-03-20’, ‘yyyy-MM-dd’) 12375324001970-01-01 00:00:00 UTC之后多少秒注意不同时区结果不同 https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html 日期之间月、天数差
返回类型名称样例描述doublemonths_between(date1, date2)months_between(‘1997-02-28 10:30:00’, ‘1996-10-30’) 3.94959677返回日期 date1 和 date2 之间的月数从 Hive 1.2.0 开始。如果 date1 晚于 date2则结果为正数。如果 date1 早于 date2则结果为负数。 date1 和 date2 类型timestamp | ‘yyyy-MM-dd’ | ‘yyyy-MM-dd HH:mm:ss’intdatediff(string enddate, string startdate)datediff(‘2009-03-01’, ‘2009-02-27’) 2