On Apr 21, 2011 5:38 AM, "cc" <c...@belfordhk.com> wrote: > > Hi, > > I have two strings that shows different times and I > want to find the difference in # of hours. > DateTime? search.cpan.org/~drolsky/DateTime-0.66/lib/DateTime.pm
> In PHP, there's strtotime(), but there isn't one > in Perl that I can find. > Why would I want to bloated my core to mess with dates when half of what I do doesn't need that functionality? > The string format is: mm/dd/yyyy hh:mm:ss > If its always in that format, just split and define a hash and pass it to dt. Otherwise, use dt:format:natural. > So if t1 and t2 are of the aforementioned format, > I just do a t2 - t1 and it should give me > the # of hours between the two datetimes. > As stated in the doc, dt overloads the variables so that you can do that easy enough. > Is there a function that can do this? > I don't think there is much to do with time and dates that dt (or other modules under that namespace) can't handle.