 |
|
Home:
Perl Programming Help:
Beginner:
Need a script to increment date and time by 30 minutes:
Edit Log
|
|

cuboidgraphix
User
Dec 26, 2012, 1:17 PM
Views: 911
|
|
Need a script to increment date and time by 30 minutes
|
|
|
Hello, I am trying to write a script to increment my time by 30 minutes for a period of 3 days. Currently I have tried installing DateTime without any success. I was wondering if there is an easier or more efficient way of writing this. For example. I have a starting date and time such as this. 17/12/2012 00:00:00 I need increments of 30 minutes.. to output as the following. 17/12/2012 00:30:00 17/12/2012 01:00:00 . . . 17/12/2012 23:30:00 then start again with a new day. 18/12/2012 00:00:00 . . . 18/12/2012 23:30:00 And so on ... for 3 to 4 days. This is what I have so far...
#!/usr/bin/perl # This is a script that will increment time by 30 minutes. use strict; use warnings; use POSIX qw/strftime/; my $Start = "17/12/2012 00:00:00"; my $End = "20/12/2012 23:00:00"; my $Now = $Start; while($Now > $End){ $Now = Some code that will add 30 minutes. }
(This post was edited by cuboidgraphix on Dec 26, 2012, 1:22 PM)
|
|
|
Edit Log:
|
|
Post edited by cuboidgraphix
(User) on Dec 26, 2012, 1:19 PM
|
|
Post edited by cuboidgraphix
(User) on Dec 26, 2012, 1:22 PM
|
|
|  |