Ok -

I changed to use the routine you suggested.... still off. And if you notice the 
adding does work fine. It is 
this code that is returning a bad date:

        public static NSTimestampFormatter formatterToDay=new 
NSTimestampFormatter("%m/%d/%y");
        public static String formatTimestampToDay(NSTimestamp date){
                return date!=null?formatterToDay.format(date):"";
        }


And as for how beginDate is created,... it is being created with timezone 
support:
                beginDate = new NSTimestamp(calendar.get(Calendar.YEAR), 
calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0, 
NSTimeZone.getDefault());

Any other thoughts?

On Oct 30, 2010, at 2:19 PM, Ramsey Lee Gurley wrote:

> Also daylight savings that week.
> 
> On Oct 30, 2010, at 3:15 PM, Chuck Hill wrote:
> 
>> timezones
>> 
>> On Oct 30, 2010, at 11:50 AM, James Cicenia wrote:
>> 
>>> Hello -
>>> 
>>> Here is the code:
>>> 
>>> weekStart = beginDate.timestampByAddingGregorianUnits(0,0,(k*7),0,0,0);
>>> weekAfterStart = 
>>> beginDate.timestampByAddingGregorianUnits(0,0,((k+1)*7),0,0,0);
>>>     
>>> System.out.println("weekStart = "+weekStart);
>>> System.out.println("weekAfterStart = "+weekAfterStart);
>>> System.out.println("converted weekAfterStart = 
>>> "+TOSUtilities.formatTimestampToDay(weekAfterStart));
>>> 
>>> OUTPUTS:
>>> 
>>> weekStart = 2010-11-01 05:00:00 Etc/GMT
>>> weekAfterStart = 2010-11-08 05:00:00 Etc/GMT
>>> convertedWeekAfterStart = 11/07/10  <<=========== wrong?! 
>>> 
>>> Thanks
>>> James
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>> 
>>> This email sent to [email protected]
>> 
>> -- 
>> Chuck Hill             Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.    
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40mac.com
>> 
>> This email sent to [email protected]
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/james%40jimijon.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to