good chemistry is complicated,
and a little bit messy -LW
Re^4: What's "Better" DateTime or localtime?by mmartin (Monk)
|on Jul 18, 2013 at 14:51 UTC||Need Help??|
Hey runrig, thanks for the reply!
Cool, good info there, thanks!
I don't know if its the "best" way to go, but I was using the dates I created using the "Time::Piece" Module, then
I use the "Date::Manip" module to calculate a future date/time (*or past date if you needed to). The cool thing about
the Date::manip Module is that you can use human relate-able strings to calculate the date.
For example, before I added the "Date::Manip" Module, and currently still, I have a Command Line Option that the user inputs when
executing. Where the value of the argument is in the form of "a number followed by a time-unit". So for instance the
user could enter any of the following:
Then after the user executes and after some error checking of the users input, I take the option the user entered, like "30 mins"
and then use that in the DateCalc Function, which is part of the Date::Manip Module. For the error checking I split the users
input into a number and a "time_unit", so "30mins" would get split into "30" and "mins", then I check each one.
So I would then take the current_date calculated by "Time::Piece qw(localtime)" and use that as the first argument to the "DateCalc"
Function, like so:
So that's basically what I'm doing with the Date stuff. There is some other stuff I do with the Date and Time but that above is
the most important part.
Thanks again for all the suggestions and info.