Perl时间处理函数

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

  use Date::Calc qw(
      Days_in_Year
      Days_in_Month
      Weeks_in_Year
      leap_year
      check_date
      check_time
      check_business_date
      Day_of_Year
      Date_to_Days
      Day_of_Week
      Week_Number
      Week_of_Year
      Monday_of_Week
      Nth_Weekday_of_Month_Year
      Standard_to_Business
      Business_to_Standard
      Delta_Days
      Delta_DHMS
      Delta_YMD
      Delta_YMDHMS
      N_Delta_YMD
      N_Delta_YMDHMS
      Normalize_DHMS
      Add_Delta_Days
      Add_Delta_DHMS
      Add_Delta_YM
      Add_Delta_YMD
      Add_Delta_YMDHMS
      Add_N_Delta_YMD
      Add_N_Delta_YMDHMS
      System_Clock
      Today
      Now
      Today_and_Now
      This_Year
      Gmtime
      Localtime
      Mktime
      Timezone
      Date_to_Time
      Time_to_Date
      Easter_Sunday
      Decode_Month
      Decode_Day_of_Week
      Decode_Language
      Decode_Date_EU
      Decode_Date_US
      Fixed_Window
      Moving_Window
      Compress
      Uncompress
      check_compressed
      Compressed_to_Text
      Date_to_Text
      Date_to_Text_Long
      English_Ordinal
      Calendar
      Month_to_Text
      Day_of_Week_to_Text
      Day_of_Week_Abbreviation
      Language_to_Text
      Language
      Languages
      Decode_Date_EU2
      Decode_Date_US2
      Parse_Date
      ISO_LC
      ISO_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_year
      if (leap_year($year))

  check_date
      if (check_date($year,$month,$day))

  check_time
      if (check_time($hour,$min,$sec))

  check_business_date
      if (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);          # DEPRECATED

  Week_of_Year
      ($week,$year) = Week_of_Year($year,$month,$day); # RECOMMENDED
      $week = Week_of_Year($year,$month,$day);         # DANGEROUS

  Monday_of_Week
      ($year,$month,$day) = Monday_of_Week($week,$year);

  Nth_Weekday_of_Month_Year
      if (($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_Month
      if ($month = Decode_Month($string[,$lang]))

  Decode_Day_of_Week
      if ($dow = Decode_Day_of_Week($string[,$lang]))

  Decode_Language
      if ($lang = Decode_Language($string))

  Decode_Date_EU
      if (($year,$month,$day) = Decode_Date_EU($string[,$lang]))

  Decode_Date_US
      if (($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);

  Uncompress
      if (($century,$year,$month,$day) = Uncompress($date))

  check_compressed
      if (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); # DEPRECATED

  Languages
      $max_lang = Languages();

  Decode_Date_EU2
      if (($year,$month,$day) = Decode_Date_EU2($string[,$lang]))

  Decode_Date_US2
      if (($year,$month,$day) = Decode_Date_US2($string[,$lang]))

  Parse_Date
      if (($year,$month,$day) = Parse_Date($string[,$lang]))

  ISO_LC
      $lower = ISO_LC($string);

  ISO_UC
      $upper = ISO_UC($string);

  Version
      $string = Date::Calc::Version();

Perl时间处理函数,布布扣,bubuko.com

时间: 2024-10-14 04:36:56

Perl时间处理函数的相关文章

C语言获取系统时间的函数

在标准C编程中,我们如何写程序来获取当前系统的时间呢? 获取系统时间的函数 #include <time.h> time_t  time(time_t  *t) 参数:如果参数不为空,那么返回值会存储一份到t所指向的空间中,参数本身是可以为空的 返回值:成功返回系统时间(秒数)  , 失败返回-1 . 我们上代码: <span style="font-size:18px;">#include<stdio.h> #include<time.h&g

SQL-数学、字符串、时间日期函数和类型转换

--数学函数 --ABS绝对值,select ABS(-99)--ceiling取上限,select CEILING(4.5)--floor去下限select FLOOR(4.5)--power 几次方,select POWER(2,2)--round四舍五入,select round (6.45,1)--sqrt开平方select SQRT(9)--square平方select SQUARE(5) --字符串函数--ASCII 返回字符串最左边的字符ascii码select ASCII('na

把多个js函数绑定到onload时间处理函数上

js的window.onload=function();网页加载完毕时会触发一个onload事件,这个事件与window对象相关联,是让一个函数在网页加载完毕之后得到执行.但是如果有两个韩式firstfunction和secondfunction都想在页面加载时执行,如果把它们逐一绑定到onload事件上,它们当中将只有最后那个才会被执行.由此我们可以得出一个结论:每个时间处理函数只能绑定一个指令. 解决方法一: window.onload=function(){ firstfunction()

ORACLE函数之日期时间运算函数

1            ADD_MONTHS 格式:ADD_MONTHS(D,N) 说明:返回日期时间D加N月后对应的日期时间.N为正时则表示D之后:N为负时则表示为D之前:N为小数则会自动先删除小数部分,而用整数部分 举例: SQL>SELECT ADD_MONTHS(SYSDATE,7) A,ADD_MONTHS(SYSDATE,-7) B,ADD_MONTHS(SYSDATE,7.9)C FROM DUAL; A                             B        

mysql中返回当前时间的函数或者常量

引用:http://blog.sina.com.cn/s/blog_6d39dc6f0100m7eo.html 1.1 获得当前日期+时间(date + time)函数:now() 除了 now() 函数能获得当前的日期时间外,MySQL 中还有下面的函数: current_timestamp()   current_timestamp localtime()   localtime localtimestamp()   localtimestamp     这些日期时间函数,都等同于 now(

JS 字符串 时间 数字函数操作 事件

字符串  操作 var s="abcdefg" s.tolowerCase()   转小写 s.toupperCase()   转大写 s.substring(2,5)   索引下标从0开始  从第3个开始截取5位 s.substr(2,5)          同上 假设 s="a,b,c,d,e,f,g" s.split(',')   有逗号  用逗号隔开字符串  好几个元素一个元素 例如: 1 var s = "a,b,c,d,e,f,g";

日期和时间处理函数

这篇文章要总结的是SQL在日期和时间处理方面的函数,总结起来,主要有以下这些函数在我们的开发过程中使用得比较多的. 1,获取当前系统时间 2,DATEADD函数 3,DATEDIFF函数 4,DATEPART函数 5,YEAR,MONTH和DAY函数 6,DATENAME函数 7,ISDATE函数 获取当前系统时间 获取当前系统时间的函数有很多,但是最常用就两个,CURRENT_TIMESTAMP和GETDATE.它们返回的日期和时间格式完全相同,但是因为CURRENT_TIMESTAMP是标准

聚合函数,数学、字符串、函数,时间日期函数

create database lianxi0425--创建一个名字为lianxi0425的数据库 go use lianxi0425 --使用练习0425这个数据库 go --创建一个学生xinxi1的表,填写学号.名字.出生年份.性别.分数.班级 create table xinxi1 ( code int not null, name varchar(50) not null, birth varchar(50) not null, sex char(10) not null, score

介绍几个C++程序中关于&quot;时间&quot;的函数

时间,我们每天都在与之打交道. 程序的世界中更是,时间无处不在. 在你编写程序的时候,很多时候需要获取当前的时间,并且进行格式化输出,所以心血来潮,就想着整理搜集几个关于"时间"的函数. 但是需要强调一点,本博客里所介绍的函数都是C++语言中的. time函数 原型: time_t time (time_t* timer); 作用: Get the current calendar time as a value of type time_t. The function returns