亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1560 | 回復(fù): 0
打印 上一主題 下一主題

顯示從之前的某個(gè)日期到今天中間經(jīng)過了哪些天 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2010-11-18 16:22 |只看該作者 |倒序?yàn)g覽
本帖最后由 heidern 于 2010-11-18 16:24 編輯

代碼寫的不好,大家點(diǎn)評一下
原文地址:http://blog.chinaunix.net/u/12973/showart_2399661.html
  1. #!/usr/local/perl5.12.2/bin/perl
  2. #Author:
  3. #   Hyper Lau <timwalker@gmail.com>
  4. #Website:
  5. #   http://heidern.cublog.cn
  6. #File:
  7. #   unix_time.pl
  8. #Create Date:
  9. #   Wed 17 Nov 2010 04:42:07 PM CST
  10. use strict;
  11. use warnings;
  12. use Time::Local;
  13. $|=1;
  14. my $old_date_Y='2010';
  15. my $old_date_M='09';
  16. my $old_date_D='20';
  17. # when you want to convert time to unixstamp,don't add 1 to month!!
  18. my $old_date_unix=timelocal(0,0,0,$old_date_D,$old_date_M-1,$old_date_Y);
  19. my $old_date=$old_date_Y.$old_date_M.$old_date_D;
  20. my ($now_date_Y,$now_date_M,$now_date_D)=get_now_date();
  21. my $now_date=$now_date_Y.$now_date_M.$now_date_D;
  22. my $now_date_unix=get_now_date_unix();
  23. while ($old_date_unix <= $now_date_unix) {
  24.     print "now date is $now_date , unixstamp is $now_date_unix\n";
  25.     print "old date is $old_date , unixstamp is $old_date_unix\n";
  26.     print "processing ".get_time($old_date_unix)." data...\n";
  27.     <STDIN>;
  28.     print "process ok! \n";
  29.     $old_date_unix+=86400;
  30. }
  31. print "===========ALL PROCESSED!!===========\n";

  32. sub get_time {
  33. # in unixstamp
  34. # out "YYYY-MM-DD HH:mm:SS"
  35.     my ($time)=@_;
  36.     $time=time until (defined($time));
  37.     my @time_format = (localtime($time))[5,4,3,2,1,0];
  38.     $time_format[0] += 1900;
  39.     $time_format[1] += 1;
  40.     foreach $_(@time_format) {
  41.         $_ = sprintf("%02d", $_);
  42.     }
  43.     my $cur_time = "$time_format[0]-$time_format[1]-$time_format[2] $time_format[3]:$time_format[4]:$time_format[5]";
  44.     return($cur_time);
  45. }
  46. sub get_now_date {
  47. # in normal
  48. # out now date(YYYY-MM-DD)
  49.     my @time_format = (localtime())[5,4,3];
  50.     $time_format[0] += 1900;
  51.     $time_format[1] += 1;
  52.     foreach $_(@time_format) {
  53.         $_ = sprintf("%02d", $_);
  54.     }
  55.     return($time_format[0],$time_format[1],$time_format[2]);
  56. }
  57. sub get_now_date_unix {
  58. # in normal
  59. #out unixstamp of now date(YYYY,MM,DD)
  60.     my @time_format = (localtime())[5,4,3];
  61.     $time_format[0] += 1900;
  62. # WARNING!! when you want to convert time to unixstamp,don't add 1 to month!!
  63. #    $time_format[1] += 1;
  64.     foreach $_(@time_format) {
  65.         $_ = sprintf("%02d", $_);
  66.     }
  67.     my $cur_date_unix=timelocal(0,0,0,$time_format[2],$time_format[1],$time_format[0]);
  68.     return($cur_date_unix);
  69. }
復(fù)制代碼
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP