http://www.perlmonks.org?node_id=1063933


in reply to Re: Newbie: Request help on creating CSV using timestamp data
in thread Newbie: Request help on creating CSV using timestamp data

I have got the start and end time using the following code,
sub starttimestamp() { my $st = localtime; return sprintf( "%04d-%02d-%02dT%02d:%02d:%02d.000-0700", $st->year + 1900, $st->mon + 1, $st->mday, $st->hour, $st->min, $st->sec ); } sub endtimestamp() { my $et = localtime; return sprintf( "%04d-%02d-%02dT%02d:%02d:%02d.000-0700", $et->year + 1900, $et->mon + 1, $et->mday, $et->hour, $et->min + 15, $et->sec ); }
Now, i need a logic where i can keep incrementing the start and end timestamps by 15 or 30 or 60 mins. Thus, having unique timestamps. But the criteria is that i need to have only 50 unique values for a week. Later, continue the same 50 timestamps for the next week and so on..