Re: how to get tomorrow date using Date::CALC



Bob wrote:
> want to take a date and return tomorrow's date..
> How to convert $tomorrow back to YY-MM-DD format?
> What is the inverse of Date_to_Days ?

Did you even *try* to look for this answer on your own? Say, in the
documentation for the function you're using, of the module you're
using?

Straight out of perldoc Date::Calc's Date_to_Days() section :
In order to convert the number returned by this function back into a
date, use the function "Add_Delta_Days()" (described further below), as
follows:

$days = Date_to_Days($year,$month,$day);
($year,$month,$day) = Add_Delta_Days(1,1,1, $days - 1);

Please make an attempt to help yourself before asking hundreds of
people around the world to read documentation to you.

> .. perl2.pl ---------------------------
> use strict; use warnings; use Date::Calc qw(:all);
>
> my ($yr2, $mon2, $day2, $tomorrow); my ($year, $month, $day);
> $yr2 = 2005; $mon2 = 3; $day2 = 20;

GAAAH. What do you have against newlines?

>
> print (" date- year: $yr2 month: $mon2 day:$day2 \n");
> $tomorrow = Date_to_Days($yr2,$mon2,$day2) + 1;
> print ("tomorrow: $tomorrow \n");
>
> ($year,$month,$day) = Today([$tomorrow]);

What made you think the Today() function takes a number of days as an
argument? The docs say:
========================================
# ($year,$month,$day) = Today([$gmt]);

<...>

If the optional (boolean) input parameter "$gmt" is given, a "true"
value ("1") will cause "gmtime()" to be used instead of "localtime()",
internally, thus returning Greenwich Mean Time (GMT, or UTC) instead of
local time.
=======================================

Nothing about this function says that it returns anything other than
*today*'s date.

Paul Lalli

.



Relevant Pages

  • Re: Startup
    ... to me> 'Large Keys/Small Keys' means just that... ... If> there is no documentation indicating that you get more keys and a bit> different operation, ... It certainly gives you the option of searching for text strings within files of any sort. ... I'd be surprised if you don't have a bob in your address book, but if you don't, try a name you know is in there. ...
    (microsoft.public.pocketpc)
  • Re: System.TimeZone interface unusable?
    ... ToLocalTime must be "A DateTime instance whose value is the local time ... as the parameter states "a UTC time". ... serializer documentation is the only other place the Kind property is ...
    (microsoft.public.dotnet.framework)
  • Re: System.TimeZone interface unusable?
    ... | ToLocalTime must be "A DateTime instance whose value is the local time ... Local time is the date and time on the ... Therefore, overriding ToLocalTime to return ... The documentation is ...
    (microsoft.public.dotnet.framework)
  • Re: devastating fire
    ... Supportive evidence and documentation will need to be hereby presented ... Bob Dylan and Rachel are walking along 5th Avenue in New York doing ...
    (rec.music.dylan)
  • Re: MS Office XP 2002
    ... "Bob I" wrote in message ... have documentation to buy. ... That was the Amazon link the OP posted. ... I still find it very odd that it's not listed in the MS Lifecycle pages, when all the other Home and Student/Student Teacher versions are... ...
    (microsoft.public.office.misc)