Re: perl - MySQL - date manipulation

  • From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 28 Oct 2008 04:01:52 -0700

Thanks for this. I think what's confusing me, is how to use perl to accomplish this. It seems perl depends on a table collumn name for the hash, but when working with the date, with MySQL, it doesn't return a collumn name for the hash. I hope I'm explaining this well. lol :)


With All Respect,
Upshaw, Lamar T
----- Original Message ----- From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, October 28, 2008 3:46 AM
Subject: Re: perl - MySQL - date manipulation


Hi,

If you need to use a database, it is easier to use the database for calculations.

You can use:

current_date() + interval 30 day
or
current_date - interval 30 day
or
'2008-10-15' + interval 30 day;
or
current_date() + interval 1 month;

There are many date calculations you can use in MySQL which you can find more about in the MySQL manual.

Octavian

----- Original Message ----- From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, October 28, 2008 12:29 PM
Subject: perl - MySQL - date manipulation


I'm working with perl and MySQL for CGI scripting, and I need to be able to calculate dates. How do I have MySQL calculate 30 days from now, and return
it to perl? Or, would it be easier to calculate 30 days from now in perl
instead? I understand how to get the present date and time in perl, but I
can't figure out how to calculate other dates. Truthfully, I'd rather do
this in MySQL and have it return to perl, because the calculated date will
be saved in a database table whether I calculate it using perl, or MySQL
anyway.

With All Respect,
Upshaw, Lamar T

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: