Hi Code Masters,
I have a function to calculate current date as -
sub currentDate {
-
my @timeParts=localtime;
-
my ($day, $month, $year) = ($timeParts[3],$timeParts[4],$timeParts[5]);
-
return ($month+1)."/".$day."/".($year+1900);
-
}
-
How do I calculate two months after today's date?
Many thanks.
Date::Calc - use strict;
-
use warnings;
-
use Date::Calc qw(Today Add_Delta_YMD Date_to_Text);
-
-
my @today = Today();
-
my @date = Add_Delta_YMD(@today, 0,2,0);
-
print "2 months from now will be: ", Date_to_Text(@date), "\n";
-
-
__END__
-
-
2 months from now will be: Thu 28-Oct-2010
5 3138 Date::Calc - use strict;
-
use warnings;
-
use Date::Calc qw(Today Add_Delta_YMD Date_to_Text);
-
-
my @today = Today();
-
my @date = Add_Delta_YMD(@today, 0,2,0);
-
print "2 months from now will be: ", Date_to_Text(@date), "\n";
-
-
__END__
-
-
2 months from now will be: Thu 28-Oct-2010
Is there a way that I can get rid of the Thu to simply display as "28-Oct-2010"?
Read the documentation. The return value of the Date_to_Text function is clearly specified: - my @today = Today();
-
my @date = Add_Delta_YMD(@today, 0,2,0);
-
my $date_fmt = (split /\s+/, Date_to_Text(@date))[1];
-
print "2 months from now will be: $date_fmt\n";
I really appreciate this, sorry for the laziness this time. I will try to do it myself the next time, thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Funnyweb |
last post by:
I have just notices that the date() function is not returning the correct
date/time on my "server".
I am running apache2 on my winxp pro laptop.
My system clock is set to the correct date,...
|
by: Sharad Gupta |
last post by:
Friends
I need a date simple date function that would append the coming month
value in my current month
like
monthname(month(date)) : gives me current month in string
i need next month , a...
|
by: ltamisin |
last post by:
Hi
Im working on a Year(Date) function right now, the output of that function
is this "2005", my question is how can i change the format into this "05"
Function: Year(Date)
Output: 2005...
|
by: Dennis M. Marks |
last post by:
What is the maximum valid date range for the date(yyyy,mm,dd) function.
--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via...
|
by: Dennis M. Marks |
last post by:
After reading section 15.9.1.1 the ECMAScript Language Specifications I
see that the date range for the Date function is +/- 100,000,000 days
from 01 Jan 1970. This is called an extrapolated...
|
by: bryan.seaton |
last post by:
I have a delete statement that is not doing what I want it to do:
Delete from LOG_TABLE where (DATE(LOG_TS)) < (DATE(CURRENT_DATE)- 21
DAYS);
It is supposed to delete all records that are 21...
|
by: Christine |
last post by:
I am having the strangest problem. I use the Date function in several
of my forms and modules in an Access 2000 mdb. Lately, wherever in my
code (in this one mdb) I use the Date function, it...
|
by: Patrick McGuire |
last post by:
I need to get the current date in vb .NET. In vba I
always used the Date() function, and the help in .NET
indicates that this function still exists, but I can't
seem to find it. The Now()...
|
by: tanichka |
last post by:
Hello you helpful folk! Please look at my script and tell me what I am doing wrong! I am cleaning the names of my music files from unnecessary symbols, and the cleaning works fine, however the perl...
|
by: murch.alexander |
last post by:
I made a simple public function to set and return a date value (see
below). I have a number of queries that call up the function to get
the "As Of Date," which is typically set to today's date....
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |