Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Day (not Date) and Time Manipulation

Status
Not open for further replies.

csiepka

Technical User
Nov 24, 2008
1
US
Hi all,

I'm trying to parse a string time and add/subtract hours from it as well as get a day of the week and add/subtract days.

I don't know if DateTime has the capability of doing this. I've only been working with Perl for the past 3 months or so, but am learning a lot. I've been trying to figure this out on my own, but i need help - cause I really don't know what modules do what i need (or if I need a module).

An example of what I'm trying to do follows:

Taking a string like this:
S@14:00-16:35/2;MTW@16:40-16:35;R@16:40-19:05/2
and parsing it by days and time - the slash two at the end of each ; means "run past the end time '2x' (this is for a monitoring job and it's required that I also stop it at the 'change of day' - i.e. 23:59-00:00) so the output should look like:

S 14:00-23:59
M 00:00-16:35,16:40-23:59
T 00:00-16:35,16:40-23:59
W 00:00-16:35,16:40-23:59
R 00:00-16:35,16:40-23:59
F 00:00-19:05

Let me know if more information is needed.

Since I've just started looking at modules, not really sure which is the best one to use for doing this type of work.

Date::Manip seems like it might but not sure if it handles string dates instead of using 'current' date/time stamps.

Thanks in advance, Christine
 
Personally, I don't understand what you want to try and achieve. Have you tried writing any code yet?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top