#!/usr/bin/perl

use strict;

use Time::Local;

my($date) = shift(@ARGV);
my($time) = shift(@ARGV);

my($sec,$min,$hours,$mday,$mon,$year);

if ($date =~ /^(\d+)(?:-(\d+)(?:-(\d+))?)?$/) {
    $year = $1;
    $mon = $2;
    $mday = $3;
}
$mon-- if ($mon);

if ($time =~ /^(\d\d)(?::(\d\d)(?::(\d\d))?)?$/) {
    $hours = $1;
    $min = $2;
    $sec = $3;
}
$sec = 0 unless ($sec);
$min = 0 unless ($min);
$hours = 0 unless ($hours);

$time = timelocal($sec,$min,$hours,$mday,$mon,$year);

printf("%04d-%02d-%02d %02d:%02d:%02d
%d
%lX
", $year, $mon+1, $mday, $hours, $min, $sec, $time, $time
);
