#!/usr/bin/perl
# $Id "RFC Call ST03" $
# $Revision: 0 $
# $Source /home/root-hjo/script.pl $
use strict;
use warnings;
use Getopt::Long;
use DateTime::Format::ISO8601;

my ($pstart);

GetOptions("s=i" => \$pstart);

#############################################################################
#                                   MAIN                                    #
#############################################################################

check_input($pstart);

#############################################################################
#                                 FUNCTIONS                                 #
#############################################################################

#################################check_input#################################
sub check_input {
    my ($date) = @_;

    if (defined($date) == '1') {
        eval { my $check = DateTime::Format::ISO8601->parse_datetime($date); };
        if ( $@ ) {
            die qq{Error : the date doesn't exist or is not like YYYYMMDD\n}
        }
        else {
            print qq{date OK\n};
        }
    }
    else {
        print qq{Error while calling script : script.pl -s [YYYYMMDD]\n};
    }
}
#############################################################################
__END__
