posted by 빠담아빠다 2016. 4. 8. 17:07

#!/usr/bin/perl



$dispatcht=&date_ymd($dispatch);



# date_ymd 함수는 Fri Apr  8 10:15:41 -> yyyymmddhh24miss 형식으로 변경해주는 함수

sub date_ymd{


        $rcvdate="";

        $rcvdate=$_[0];

        $trmon="";

        $trday="";

        $trhour="";

        $trmin="";

        $trsec="";


        $trmon = substr($rcvdate,4,3);

        $trmon =$des{$trmon};

        if(substr($trmon,1,1) eq ""){$trmon = "0$trmon";}

        $trday = substr($rcvdate,8,2);

        $trday =~ s/ //;

        if(substr($trday,1,1) eq ""){$trday = "0$trday";}

        $trhour = substr($rcvdate,11,2);

        if(substr($trhour,1,1) eq ""){$trhour = "0$trhour";}

        $trmin = substr($rcvdate,14,2);

        if(substr($trmin,1,1) eq ""){$trmin = "0$trmin";}

        $trsec = substr($rcvdate,17,2);

        if(substr($trsec,1,1) eq ""){$trsec = "0$trsec";}


        $trtime = "$year$trmon$trday$trhour$trmin$trsec";


        # return $trtime

        return $trtime;


}



'Language > Perl' 카테고리의 다른 글

[Perl] 날짜 관련  (0) 2016.04.25
[Perl] -help option sub함수  (0) 2016.04.25
[per] today, yesterday, nextday  (3) 2016.03.10
[perl] hash of hash  (0) 2016.03.10
[perl] update 쿼리  (0) 2016.03.10