• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Date calculation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date calculation


  • Subject: Re: Date calculation
  • From: Randall Perry <email@hidden>
  • Date: Fri, 23 Apr 2004 14:59:34 -0400

The code below works if I include the package:J)
    import java.util.Calendar;


> Never mind. I had the code outside any function in a class file.
>
> Excuse me, I'm learning :-(
>
>> Again, with this code, on line 2 I get the error '<identifier expected>'. Am
>> I
>> missing a package or something?
>>
>>
>>> Calendar cal = Calendar.getInstance(); // cal is set to current date
>>> cal.add(Calendar.YEAR, -1); // subtracts 1 year from the calendar
>>> NSTimestamp oneYearAgo = new NSTimestamp(cal.getTimeInMillis());

--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Date calculation (From: Randall Perry <email@hidden>)

  • Prev by Date: Re: Date calculation
  • Next by Date: Xcode 1.2?
  • Previous by thread: Re: Date calculation
  • Next by thread: Java reference book for WO programmers
  • Index(es):
    • Date
    • Thread