当前位置: 首页 > 编程日记 > 正文

Perl时间处理函数

官方网址:http://search.cpan.org/~stbey/Date-Calc-6.3/lib/Date/Calc.pod#___top

use Date::Calc qw(Days_in_YearDays_in_MonthWeeks_in_Yearleap_yearcheck_datecheck_timecheck_business_dateDay_of_YearDate_to_DaysDay_of_WeekWeek_NumberWeek_of_YearMonday_of_WeekNth_Weekday_of_Month_YearStandard_to_BusinessBusiness_to_StandardDelta_DaysDelta_DHMSDelta_YMDDelta_YMDHMSN_Delta_YMDN_Delta_YMDHMSNormalize_DHMSAdd_Delta_DaysAdd_Delta_DHMSAdd_Delta_YMAdd_Delta_YMDAdd_Delta_YMDHMSAdd_N_Delta_YMDAdd_N_Delta_YMDHMSSystem_ClockTodayNowToday_and_NowThis_YearGmtimeLocaltimeMktimeTimezoneDate_to_TimeTime_to_DateEaster_SundayDecode_MonthDecode_Day_of_WeekDecode_LanguageDecode_Date_EUDecode_Date_USFixed_WindowMoving_WindowCompressUncompresscheck_compressedCompressed_to_TextDate_to_TextDate_to_Text_LongEnglish_OrdinalCalendarMonth_to_TextDay_of_Week_to_TextDay_of_Week_AbbreviationLanguage_to_TextLanguageLanguagesDecode_Date_EU2Decode_Date_US2Parse_DateISO_LCISO_UC);use Date::Calc qw(:all);Days_in_Year$days = Days_in_Year($year,$month);Days_in_Month$days = Days_in_Month($year,$month);Weeks_in_Year$weeks = Weeks_in_Year($year);leap_yearif (leap_year($year))check_dateif (check_date($year,$month,$day))check_timeif (check_time($hour,$min,$sec))check_business_dateif (check_business_date($year,$week,$dow))Day_of_Year$doy = Day_of_Year($year,$month,$day);Date_to_Days$days = Date_to_Days($year,$month,$day);Day_of_Week$dow = Day_of_Week($year,$month,$day);Week_Number$week = Week_Number($year,$month,$day); # DEPRECATEDWeek_of_Year($week,$year) = Week_of_Year($year,$month,$day); # RECOMMENDED$week = Week_of_Year($year,$month,$day); # DANGEROUSMonday_of_Week($year,$month,$day) = Monday_of_Week($week,$year);Nth_Weekday_of_Month_Yearif (($year,$month,$day) =Nth_Weekday_of_Month_Year($year,$month,$dow,$n))Standard_to_Business($year,$week,$dow) =Standard_to_Business($year,$month,$day);Business_to_Standard($year,$month,$day) =Business_to_Standard($year,$week,$dow);Delta_Days$Dd = Delta_Days($year1,$month1,$day1,$year2,$month2,$day2);Delta_DHMS($Dd,$Dh,$Dm,$Ds) =Delta_DHMS($year1,$month1,$day1, $hour1,$min1,$sec1,$year2,$month2,$day2, $hour2,$min2,$sec2);Delta_YMD($Dy,$Dm,$Dd) =Delta_YMD($year1,$month1,$day1,$year2,$month2,$day2);Delta_YMDHMS($D_y,$D_m,$D_d, $Dh,$Dm,$Ds) =Delta_YMDHMS($year1,$month1,$day1, $hour1,$min1,$sec1,$year2,$month2,$day2, $hour2,$min2,$sec2);N_Delta_YMD($Dy,$Dm,$Dd) =N_Delta_YMD($year1,$month1,$day1,$year2,$month2,$day2);N_Delta_YMDHMS($D_y,$D_m,$D_d, $Dhh,$Dmm,$Dss) =N_Delta_YMDHMS($year1,$month1,$day1, $hour1,$min1,$sec1,$year2,$month2,$day2, $hour2,$min2,$sec2);Normalize_DHMS($Dd,$Dh,$Dm,$Ds) =Normalize_DHMS($Dd,$Dh,$Dm,$Ds);Add_Delta_Days($year,$month,$day) =Add_Delta_Days($year,$month,$day,$Dd);Add_Delta_DHMS($year,$month,$day, $hour,$min,$sec) =Add_Delta_DHMS($year,$month,$day, $hour,$min,$sec,$Dd,$Dh,$Dm,$Ds);Add_Delta_YM($year,$month,$day) =Add_Delta_YM($year,$month,$day,$Dy,$Dm);Add_Delta_YMD($year,$month,$day) =Add_Delta_YMD($year,$month,$day,$Dy,$Dm,$Dd);Add_Delta_YMDHMS($year,$month,$day, $hour,$min,$sec) =Add_Delta_YMDHMS($year,$month,$day, $hour,$min,$sec,$D_y,$D_m,$D_d, $Dh,$Dm,$Ds);Add_N_Delta_YMD($year,$month,$day) =Add_N_Delta_YMD($year,$month,$day,$Dy,$Dm,$Dd);Add_N_Delta_YMDHMS($year,$month,$day, $hour,$min,$sec) =Add_N_Delta_YMDHMS($year,$month,$day, $hour,$min,$sec,$D_y,$D_m,$D_d, $Dhh,$Dmm,$Dss);System_Clock($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) =System_Clock([$gmt]);Today($year,$month,$day) = Today([$gmt]);Now($hour,$min,$sec) = Now([$gmt]);Today_and_Now($year,$month,$day, $hour,$min,$sec) = Today_and_Now([$gmt]);This_Year$year = This_Year([$gmt]);Gmtime($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) =Gmtime([time]);Localtime($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) =Localtime([time]);Mktime$time = Mktime($year,$month,$day, $hour,$min,$sec);Timezone($D_y,$D_m,$D_d, $Dh,$Dm,$Ds, $dst) = Timezone([time]);Date_to_Time$time = Date_to_Time($year,$month,$day, $hour,$min,$sec);Time_to_Date($year,$month,$day, $hour,$min,$sec) = Time_to_Date([time]);Easter_Sunday($year,$month,$day) = Easter_Sunday($year);Decode_Monthif ($month = Decode_Month($string[,$lang]))Decode_Day_of_Weekif ($dow = Decode_Day_of_Week($string[,$lang]))Decode_Languageif ($lang = Decode_Language($string))Decode_Date_EUif (($year,$month,$day) = Decode_Date_EU($string[,$lang]))Decode_Date_USif (($year,$month,$day) = Decode_Date_US($string[,$lang]))Fixed_Window$year = Fixed_Window($yy);Moving_Window$year = Moving_Window($yy);Compress$date = Compress($year,$month,$day);Uncompressif (($century,$year,$month,$day) = Uncompress($date))check_compressedif (check_compressed($date))Compressed_to_Text$string = Compressed_to_Text($date[,$lang]);Date_to_Text$string = Date_to_Text($year,$month,$day[,$lang]);Date_to_Text_Long$string = Date_to_Text_Long($year,$month,$day[,$lang]);English_Ordinal$string = English_Ordinal($number);Calendar$string = Calendar($year,$month[,$orthodox[,$lang]]);Month_to_Text$string = Month_to_Text($month[,$lang]);Day_of_Week_to_Text$string = Day_of_Week_to_Text($dow[,$lang]);Day_of_Week_Abbreviation$string = Day_of_Week_Abbreviation($dow[,$lang]);Language_to_Text$string = Language_to_Text($lang);Language$lang = Language();Language($lang); # DEPRECATED$oldlang = Language($newlang); # DEPRECATEDLanguages$max_lang = Languages();Decode_Date_EU2if (($year,$month,$day) = Decode_Date_EU2($string[,$lang]))Decode_Date_US2if (($year,$month,$day) = Decode_Date_US2($string[,$lang]))Parse_Dateif (($year,$month,$day) = Parse_Date($string[,$lang]))ISO_LC$lower = ISO_LC($string);ISO_UC$upper = ISO_UC($string);Version$string = Date::Calc::Version();

转载于:https://www.cnblogs.com/james6176/p/3794407.html

相关文章:

Linux环境搭建 | 手把手教你安装Linux虚拟机

2019独角兽企业重金招聘Python工程师标准>>> 前言 作为一名Linux工程师,不管是运维、应用、驱动方向,在工作中肯定会需要Linux环境。想要获得Linux环境,一个办法就是将电脑系统直接换成Linux系统,但我们平常用惯了Wind…

企业的覆灭,我监视你的Exchange邮件!

现在很多企业都搭建ExchangeServer平台,一个用户包括Domain admins都是不允许查阅其他用户的邮件信息的!殊不知作为Domain Admins权限用户可以经过精心的设置,可以达到浏览到其他用户邮件信息! 转载于:https://www.cnblogs.com/al…

(C++)1002 写出这个数

#include<cstdio> #include<cstring>const int M 100; //用字符数组装输入 //定义变量&#xff0c;输出字符数组的长度 //对字符数组遍历求和 //对结果逐位输出汉语拼音 void hanzi(int i){switch(i){case 0:printf("ling");break;case 1:printf("…

IO复用之epoll系列

epoll是什么&#xff1f; epoll是Linux内核为处理大批量文件描述符而作了改进的poll&#xff0c;是Linux下多路复用IO接口select/poll的增强版本&#xff0c;它能显著提高程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率。另一点原因就是获取事件的时候&#xff0c;它…

MVP Summit 2008 照片纪实(二)- 旧金山,Google总部和Stanford大学

坐在洛杉矶机场里&#xff0c;终于为这次MVP峰会的美国之行画上了句号。从旧金山到拉斯维加斯&#xff0c;从拉斯维加斯到大峡谷&#xff0c;最后从大峡谷返回洛杉矶&#xff0c;3天之中总共驾驶历程超过1600英里&#xff08;据说可以赶上出租车司机了&#xff09;。3天之中经历…

(C++)1025 PAT Ranking

#include<cstdio> #include<algorithm> #include<cstring>using namespace std;const int M 100*300;struct testee{//考生 char reg_num[14];//准考证号 int score;//分数 int final_rank;//最终排名 int loc_no;//考场号 int local_rank;//考场内排名 }te…

模态视图(转)

转载请注明出处&#xff0c;原文网址&#xff1a;http://blog.csdn.net/m_changgong/article/details/8127894 作者&#xff1a;张燕广 模态视图不是专门的某个类&#xff0c;而是通过视图控制器的presentViewController方法弹出的视图&#xff0c;我们称为模态视图。 模态视图…

MHA二种高可用架构切换演练

高可用架构一 proxysqlkeepalivedmysqlmha优势&#xff0c;最大程序的降低脑裂风险&#xff0c;可以读写分离&#xff08;需要开启相应的插件支持&#xff09; 一、proxysql 1、安装 tar -zxvf proxysql.tar.gz -C /usr/local/chmod -R 700 /usr/local/proxysqlcd /usr/local/p…

如何关闭事件跟踪程序

最近经常遇到一些独享服务器用户反应自己的服务器联系万网工程师重起后&#xff0c;重新登陆时遇到的界面不知道该如何操作问题。当您看到此界面时&#xff0c;只需要在“注释”下面的空白处随意输入字符即可激活“确定”按钮&#xff0c;点击“确定”后可以进入系统。 这个界…

(C++)1015 德才论

#include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int M 100000;struct Testee{char no[10];int de;int cai;int type;//第几类 }peo[M10];bool cmp(Testee a,Testee b){//比较顺序依次为总分&#xff0c;德分&#xf…

Vim命令相关

在shell中&#xff0c;记住一些常用的vim命令&#xff0c;会在操作时候事半功倍。 光标移动 h,j,k,l,h #表示往左&#xff0c;j表示往下&#xff0c;k表示往右&#xff0c;l表示往上 Ctrl f #上一页 Ctrl b #下一页 w, e, W, E #跳到单词的后面&#xff0c;小…

做科研的几点体会

刚刚开始做实验的时候&#xff0c;别人怎么说我就怎么做&#xff0c;每天在实验台旁干到深夜&#xff0c;以为这就是科研了。两个月过去&#xff0c;突然发现自己还在原地踏步。那种感觉&#xff0c;只能用”沮丧”来形 容。我开始置疑自己的行为和观念。感觉有种习惯的力量在束…

ICMP报文分析

一.概述&#xff1a;1. ICMP同意主机或路由报告差错情况和提供有关异常情况。ICMP是因特网的标准协议&#xff0c;但ICMP不是高层协议&#xff0c;而是IP层的协议。通常ICMP报文被IP层或更高层协议&#xff08;TCP或UDP&#xff09;使用。一些ICMP报文把差错报文返回给用户进…

(C++)1029 旧键盘

#include<cstdio> #include<cstring>const int M 80;//值得注意的地方是“按照发现顺序 ” //采取的最佳策略是&#xff0c;对于字符串1中的每一个字符&#xff0c;看在字符串2中是否出现int hashmap(char c){int res 0;if(0<c&&c<9){res c-0;}e…

深入理解 python 元类

一、什么的元类 # 思考&#xff1a; # Python 中对象是由实例化类得来的&#xff0c;那么类又是怎么得到的呢&#xff1f; # 疑问&#xff1a; # python 中一切皆对象&#xff0c;那么类是否也是对象&#xff1f;如果是&#xff0c;那么它又是那个类实例化而来的呢&…

使用.NET REACTOR制作软件许可证

使用.NET REACTOR制作软件许可证 原文:使用.NET REACTOR制作软件许可证软件下载地址&#xff1a;http://www.eziriz.com/downloads.htm 做一个简单的许可证系统&#xff0c;下面是具体步骤&#xff1a;1&#xff0c; OPEN ASSEMBLY打开项目可执行文件(debug文件夹里面exe文件…

(C++)CSP 201712-2 游戏

#include<cstdio> #include<algorithm> using namespace std;const int M 1000;int k;bool obsl(int x){if(x%k0||x%10k){return true;//淘汰 }else return false; }int main(){int n;//孩子的个数 scanf("%d%d",&n,&k);int i1;//现在报的数 in…

在wpf中运行EXE文件

最简单的方法&#xff1a;System.Diagnostics.Process.Start("路径");网上的其他方法&#xff1a; Process p new System.Diagnostics.Process(); p.StartInfo.FileName "路径"; p.StartInfo.Arguments ""; …

C语言程序试题

一个无向连通图G点上的哈密尔顿&#xff08;Hamiltion&#xff09;回路是指从图G上的某个顶点出发&#xff0c;经过图上所有其他顶点一次且仅一次&#xff0c;最后回到该顶点的路劲。一种求解无向图上哈密尔顿回路算法的基础实现如下&#xff1a; 假设图G存在一个从顶点V0出发的…

利用OWC创建图表的完美解决方案

http://onlytiancai.cnblogs.com/archive/2005/08/24/221761.html 转载于:https://www.cnblogs.com/Athrun/archive/2008/05/19/1202909.html

(C++)1020 月饼 简单贪心

#include<cstdio> #include<algorithm> using namespace std;int types,weight;//月饼的种类数 struct Mooncake{double totalPrice;double price;double weight;double sell;//卖出了多少 };bool cmp(Mooncake a,Mooncake b){return a.price>b.price; }int ma…

枚举,给枚举赋值

/**************枚举*****************/// public enum Colors{// Red,Yellow,Blue,Black,White// }// public static void main(String[] args) {// Colors c Colors.Yellow;// System.out.println(c);//输出枚举// System.out.println(c.ordinal());//输出枚举对应的序号…

青岛...沙尘暴!太可怕了~什么事儿都有!

受蒙古国和我国内蒙古地区出现沙尘暴天气的影响&#xff0c;28日&#xff0c;山东省青岛、烟台等地出现大范围浮尘天气&#xff0c;空气质量明显下降。 28日&#xff0c;一场大范围的浮尘天气影响到烟台&#xff0c;天空一片浑浊&#xff0c;能见度不足5公里&#xff0c;空气质…

面试题收集最新

Java高级程序员面试题------https://www.cnblogs.com/mengdou/p/7233398.html Java高级工程师面试题总结及参考答案-----https://www.cnblogs.com/java1024/p/8594784.html Java高级程序员&#xff08;5年左右&#xff09;面试的题目集----https://blog.csdn.net/fangqun663775…

(C++)1023 组个最小数 简单贪心

#include<cstdio> //#include<algorithm> //using namespace std; //用hash思想读入数字 //解决最高位放谁 //解决后面的位数 //输出 int main(){int key[10];for(int i0;i<10;i){scanf("%d",&key[i]);}//解决最高位for(int i1;i<10;i){if(ke…

Nginx 在centos linux 安装、部署完整步骤并测试通过

需要先装pcre, zlib&#xff0c;前者为了重写rewrite&#xff0c;后者为了gzip压缩。 1.选定源码目录 选定目录 /usr/local/ cd /usr/local/ 2.安装PCRE库 cd /usr/local/ wget http://exim.mirror.fr/pcre/pcre-8.02.tar.gz tar -zxvf pcre-8.02.tar.gz cd pcre-8.02 ./config…

Ubuntu16.04安装qt

5.11官方下载网站&#xff1a; http://download.qt.io/official_releases/qt/5.11/5.11.1/ 可以直接下载linux系统下的.run安装包&#xff1a; 安装方式&#xff1a;https://www.jb51.net/LINUXjishu/501994.html 切换到.run所在的目录&#xff0c;然后 第一步&#xff1a; chm…

好男人是怎么变坏的

十岁以前&#xff0c;就不说了&#xff0c;无非是淘气和不懂事。 十三、四岁的时候&#xff0c;开始对女孩有好感&#xff0c;但是那时候他离女孩远远的&#xff0c;并且以讨厌女孩自居&#xff0c;生怕被同伴嘲笑。 十五岁的时候&#xff0c;听到大人们说某某男人好花&#xf…

(C++)小明种苹果(续)

#include<cstdio>struct tree{int left;//剩余的果子数量bool fallfalse;//是否发生掉落int falls0;//这颗数前面的树&#xff08;包括自身&#xff09;发生掉落的次数 }trs[1000];int main(){int n;//树的总数scanf("%d",&n);for(int i0;i<n;i){//对于…

MySQL如何判别InnoDB表是独立表空间还是共享表空间

InnoDB采用按表空间&#xff08;tablespace)的方式进行存储数据, 默认配置情况下会有一个初始大小为10MB&#xff0c; 名字为ibdata1的文件&#xff0c; 该文件就是默认的表空间文件&#xff08;tablespce file&#xff09;&#xff0c;用户可以通过参数innodb_data_file_path对…