Greetings fellow Monks
I am using Date::Manip. What I want to do is generate 90 days from the current date and enter it into a MySql table, which also has the datatype as DATE.
The date when i insert into the field, comes as the year 2020, instead of 2004. the month and day field are okay.
The code for inserting is as shown below. Please help me out.
#!/usr/bin/perl # get current Date from MySql use warnings; use strict; use DBI; use Date::Manip; my ($dbh, $rows); $dbh=DBI->connect('dbi:mysql:VISA','root','elephant') || die "Error opening database: $DBI::errstr\n"; my $date; #$date = DateCalc("today","+ 90 days"); $date=ParseDate("in 90 days"); print "Date: $date\n"; $rows=$dbh->do("INSERT INTO appCancel (appt_date,status, no_cancel, ci +ty) VALUES('$date' , 'U' , '0' , 'M')") || die "Couldn't insert record : $DBI::errstr"; $dbh->finish();
the date which comes into the record has 2020 as the year.

In reply to Date::Manip Help by Agyeya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.