I am attempting to write a script where the user enters the month and day (two digit format). I am trying to have script will increase 6 more times (totaling 7). I am having issues with the script increasing by one ... i realized i couldnt get it to switch over to the next month if the search falls between the end of one and beginning of another month. ...
Here's an idea -
Code:
$
$ # change of month within 7 days from input
$ echo "2/26/2010" | perl -lne 'BEGIN {use DateTime} ($m,$d,$y)=split/\//;
$dt=DateTime->new(year=>$y,month=>$m,day=>$d);
for (0..6) {print $_,"\t",$dt->mdy("/"); $dt->add(days=>1)}'
0 02/26/2010
1 02/27/2010
2 02/28/2010
3 03/01/2010
4 03/02/2010
5 03/03/2010
6 03/04/2010
$
$ # the case of a leap year
$ echo "2/26/2008" | perl -lne 'BEGIN {use DateTime} ($m,$d,$y)=split/\//;
$dt=DateTime->new(year=>$y,month=>$m,day=>$d);
for (0..6) {print $_,"\t",$dt->mdy("/"); $dt->add(days=>1)}'
0 02/26/2008
1 02/27/2008
2 02/28/2008
3 02/29/2008
4 03/01/2008
5 03/02/2008
6 03/03/2008
$
$ # change of year within 7 days from input
$ echo "12/27/2009" | perl -lne 'BEGIN {use DateTime} ($m,$d,$y)=split/\//;
$dt=DateTime->new(year=>$y,month=>$m,day=>$d);
for (0..6) {print $_,"\t",$dt->mdy("/"); $dt->add(days=>1)}'
0 12/27/2009
1 12/28/2009
2 12/29/2009
3 12/30/2009
4 12/31/2009
5 01/01/2010
6 01/02/2010
$
$
I am working on a bash script to backup selected servers and am trying to come up with a simpler solution to this problem:
Each server to be backed up has a config file that is read by the script, in the config file are the following values:
LEVEL0=12 #this is the day of the month on which... (3 Replies)
Hello friends,
I am looking for a script or method that can display all the dates between any 2 given dates.
Input:
Date 1
290109
Date 2
010209
Output:
300109
310109
Please help me. Thanks. :):confused: (2 Replies)
Good morning all!
I am new to programming and trying to learn; please be patient.
I am wanting to write a script that takes the current date and gzip 5 days or older, then remove 10 days or older.
This is the directory I want to work in; this is what it looks like
... (2 Replies)
Hi.,
After retrieving values from DB I have two datestamps in format:
12/01/2010:05:40:00 AM and 12/01/2010:06:00:00 PM.
general time format: MM/DD/YYYY:HH:MM:SS AM or PM
Any quick solution to get the difference of two in the format : 1 day(s) 12:20:00
Thanks., (6 Replies)
Hello,
Is there a script template out there that will assist me on creating a script to search for dates with "2011" and change it to "2012" in an excel spreadsheet. I am in Ksh
:confused:
Thank you,
Bryan (1 Reply)
Hi All,
I have a date variable say dt="2014-01-06 07:18:38"
Now i need to use this variable to search a log and get the entries which occured after that time. (1 Reply)
Hi from Uruguay.
Im having a problem with a scripts using dates, this is the problem:
I have a folder for each day, like : 20160711 for yesterday, 20160712 for today, and i want to mv to a backup folder the folders who exceed the year of antiquity (365 days from today) and that script execute... (3 Replies)
I am having below script which needs to be executed based on start and end date
#!/bin/bash
array=('2016-09-27' '2016-10-27' '2016-11-27' '2016-12-27' '2017-01-27' '2017-02-27' '2017-03-27' '2017-04-27' '2017-05-27' '2017-06-27' '2017-07-27' '2017-08-27' '2017-09-27' )
for i in "${array}"
do... (9 Replies)
Discussion started by: rohit_shinez
9 Replies
LEARN ABOUT DEBIAN
datetime::format::epoch::dotnet
DateTime::Format::Epoch::DotNet(3pm) User Contributed Perl Documentation DateTime::Format::Epoch::DotNet(3pm)NAME
DateTime::Format::Epoch::DotNet - Convert DateTimes to/from .NET epoch seconds
SYNOPSIS
use DateTime::Format::Epoch::DotNet;
my $dt = DateTime::Format::Epoch::DotNet->parse_datetime( 1051488000 );
DateTime::Format::Epoch::DotNet->format_datetime($dt);
# 1051488000
my $formatter = DateTime::Format::Epoch::DotNet->new();
my $dt2 = $formatter->parse_datetime( 1051488000 );
$formatter->format_datetime($dt2);
DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since the
epoch defined in the .NET Framework SDK.
Note that this epoch is defined in the local time zone. This means that these two pieces of code will print the same number of seconds,
even though they represent two datetimes 6 hours apart:
$dt = DateTime->new( year => 2003, month => 5, day => 2,
time_zone => 'Europe/Amsterdam' );
print $formatter->format_datetime($dt);
$dt = DateTime->new( year => 2003, month => 5, day => 2,
time_zone => 'America/Chicago' );
print $formatter->format_datetime($dt);
METHODS
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor.
o new()
Constructor of the formatter/parser object. It has no parameters.
SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
AUTHOR
Eugene van der Pijll <pijll@gmx.net>
COPYRIGHT
Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
DateTime
datetime@perl.org mailing list
perl v5.10.1 2007-12-03 DateTime::Format::Epoch::DotNet(3pm)