Re: help regex replacement
Michael Ludwig <[email protected]> Tue, 1 May 2012 00:09:53 +0200
| Newsgroups | gmane.comp.lang.perl.active-perl |
|---|---|
| Message-ID | <20120430220953.GH3472@Dago> |
zilore mumba schrieb am 30.04.2012 um 14:28 (-0700): > sample input > > start_date = '2012-04-29_00:00:00','2012-04-29_00:00:00','2012-04-29_00:00:00', > end_date = '2012-05-01_00:00:00','2012-05-01_00:00:00','2012-05-01_00:00:00', > > The model would have run on 29th May, to produce a 48hour forecast to > 1sr May 2012. > When I run it on 30th May it should produce a 48hour forecast to 2nd > May, i.e. change the entries above so that start_date is 30th and > end_date is 2nd May as below. > > start_date = '2012-04-30_00:00:00','2012-04-30_00:00:00','2012-04-30_00:00:00', > end_date = '2012-05-02_00:00:00','2012-05-02_00:00:00','2012-05-02_00:00:00', It appears you want to do date arithmetics. Consider using the DateTime module instead of hacking away at the strings using regular expressions. https://metacpan.org/module/DateTime I'm not an expert DateTime user but a cursory reading/skimming of the man page suggests you'll want to heed this advice: If you are going to be using doing date math, please read the section "How Datetime Math Works". https://metacpan.org/module/DateTime#How-Datetime-Math-Works Good luck, Michael _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs