Add tags

Add tags to the following comment
Perlにまでパーサっがあったのですね。。。
僕が妥協した時はPOSIXを使ったべた書きでした。
# ほとんどCとかわりません(笑
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env perl
use strict;
use POSIX qw/strftime mktime/;

sub DateEx($$)
{
        my $outDate = '';
        my @t = ($_[0] =~ m/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/);

        $t[0] -= 1900; $t[1] -= 1; @t = reverse @t;
        $t[0] += $_[1];
        mktime( @t );
        return strftime("%Y%m%d%H%M%S", @t);
}

print DateEx("20080827235925",40) . "\n";

__END__
#EOF

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...