List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:January 6 2006 2:43am
Subject:Re: Getting # of days until expiration
View as plain text  
Brian,

/>I'm trying to show the number of days until the expiration date, which is
 >30 days in the future from the date in the field. /

DATEDIFF( DATE_ADD( datefield, INTERVAL 30 DAY), NOW() )

PB

-----

Brian Dunning wrote:

> I have a DATE field that includes a date sometime within the past 30  
> days. I'm trying to show the number of days until the expiration  
> date, which is 30 days in the future from the date in the field. I've  
> tried a bunch of permutations of something like this:
>
> select (30 - SUBDATE(CURDATE() - datefield)) as expiration_days
>
> All my permutations give me errors. Can someone set me straight? I'm  
> hoping to get an integer between 1 and 30 (30 day old records are  
> purged separately).
>
> Thanks....
>

Attachment: [text/html]
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.13/221 - Release Date: 1/4/2006
Thread
Getting # of days until expirationBrian Dunning6 Jan
  • Re: Getting # of days until expirationScott Haneda6 Jan
  • Re: Getting # of days until expirationPeter Brawley6 Jan
    • Re: Getting # of days until expirationBrian Dunning6 Jan
      • Re: Getting # of days until expirationMichael Stassen6 Jan
        • Re: Getting # of days until expirationBrian Dunning7 Jan
          • Re: Getting # of days until expirationJake Peavy8 Jan