Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Convert from "7/Jun/2010:23:02:10 " to 2010061802:00:14 in perl

Replies are listed 'Best First'.
Re: date format
by almut (Canon) on Jun 20, 2010 at 09:27 UTC
    sub convert { if ($_[0] eq "7/Jun/2010:23:02:10 ") { return "2010061802:00:14"; } }
      Almut's solution is good, but not scalable. If you use a hash, you can easily add more dates in the future.

      my %DATES = ( "7/Jun/2010:23:02:10 " => "2010061802:00:14", "7/Zog/2100:12:63:13 " => "2010060608:39:11", "my birthday" => "1974012618:12:10", #simply add all the other dates to this hash! ); sub convert { return $DATES{$_[0]} }
Re: date format
by Corion (Patriarch) on Jun 20, 2010 at 09:24 UTC

    Hello and welcome to Perlmonks!

    This site is about solving problems with Perl and learning about Perl. We will gladly help you if you show us your Perl code, the problem you're trying to solve and if you tell us where exactly you encounter problems.

    This site is not a code writing service. If you want code to be written for you, you will need to hire somebody for money.

Re: date format
by ahmad (Hermit) on Jun 20, 2010 at 12:43 UTC

    What's the relation between those two dates?

    Can you explain where did you get that 2010061802:00:14 from ?