5 messages in com.mysql.lists.mysqlRe: Date increment
FromSent OnAttachments
Peter Lauri30 Nov 2005 00:46 
Jyrki Laurila30 Nov 2005 00:57 
Ciprian Constantinescu30 Nov 2005 03:43 
Cal Evans30 Nov 2005 07:23 
Peter Brawley30 Nov 2005 13:47 
Subject:Re: Date increment
From:Cal Evans (ca@calevans.com)
Date:11/30/2005 07:23:55 AM
List:com.mysql.lists.mysql

You could use something like

from_unixtime(to_unixtime(dateField)+(86400*17))

I store dates in unix timestamp format in bigints whenever possible for this very reason.

=C=

Peter Lauri wrote:

Best group member,

I have a field called expiredate of type ‘date’. I would like to add 17 days to the expiredate without doing any scripting, is that possible?

Example:

Expiredate is 2005-11-30 and I want to extend the expiredate with 17 days. Is there any function in MySQL that adds days to a date?

A solution for this would be to write a PHP script that takes the date and adds 17 days to it (checking month overlap and stuff), but I want to skip scripting if there is an solution within MySQL that does it for me.

------------------------------------------------------------------------