in reply to Re: String (date) to time (integer)
in thread String (date) to time (integer)
This example prints the epoch values for each date, as the OP said he wanted to convert them to an integer (and epoch is what the time function returns), but the DateTime suite also includes tools for displaying the date in pretty much whatever format you may want if epoch isn't what you're looking for.#!/usr/bin/perl use strict; use warnings; use DateTime::Format::Strptime; my $date_parser = DateTime::Format::Strptime->new(pattern => '%D'); while (<DATA>) { print $date_parser->parse_datetime($_)->epoch, "\n"; } __DATA__ 06/06/2009 01/30/2009
|
|---|