🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18193

Re: Q: Date Arithmetic

#18193
From: Bob Hayden
Date: Mon, 27 Jul 1998 00:00
27 lines
1304 bytes
What about doing something like the following?

long month_time = months * 60 * 60 * 24 * 30;
long cur_time = readRow.getTimeStamp( "START_DATE" ).getTime();

dataRow.setTimestamp( "TEST_DATE", 
  new Timestamp( month_time + cur_time ) );


Is this acceptable Java programming :-) ?


Bob Hayden wrote:
> 
> Hello,
> 
> I need some help with some simple date arithmetic. I would like to take
> a java.sql.timestamp and add an int amount of months to this.  Can
> someone provide an example of how this is done (without using the
> deprecated date class set* methods)... I don't quite understand if I
> need to use the calendar class, or how to do this since it is abstract.
> 
> Thanks,
> 
> -Bob
> 
> (remove the "nospam" if replying to me directly)
Technical Details
Message-ID: <35BCBBB4.7AD7028D@nospam.ljpc.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35B92473.A5C3592E@nospam.ljpc.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,2cd4aa1b0d3dbb0b
X-Google-Attributes: gidf74b3,public
From: Bob Hayden <bob@nospam.ljpc.com>
Subject: Re: Q: Date Arithmetic
Date: 1998/07/27
Message-ID: <35BCBBB4.7AD7028D@nospam.ljpc.com>
X-Deja-AN: 375372649
Content-Transfer-Encoding: 7bit
References: <35B92473.A5C3592E@nospam.ljpc.com>
Content-Type: text/plain; charset=us-ascii
Organization: La Jolla Pharmaceutical Company
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language