• 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: Using NSAppleEventDescriptor with NSDates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSAppleEventDescriptor with NSDates


  • Subject: Re: Using NSAppleEventDescriptor with NSDates
  • From: Mike Abdullah <email@hidden>
  • Date: Sat, 9 Sep 2006 18:03:06 +0100

This was a thread around 8 months ago. I was looking for a way to get an NSAppleEventDescriptor of an NSDate. Matt Neuberg suggested a solution:

Hint: An 'ldt ' (note the space) is a LongDateTime, which is a signed 64-bit
integer representing the number of seconds since the start of 1904. You may
find the utilities on this page helpful:

And I have now (finally) achieved this.

The reason I'm posting this is that there is still nothing really helpful on this on Google, so I figured for the archives I'd post my category for doing this.

Mike.


@implementation NSAppleEventDescriptor (NSDate)

+ (NSAppleEventDescriptor *)descriptorWithDate:(NSDate *)date
{
	return [[[[self class] alloc] initWithDate: date] autorelease];
}

- (id)initWithDate:(NSDate *)date
{
	// Get the time interval since 1st Jan 2001 of the date
	CFAbsoluteTime timeInterval = CFDateGetAbsoluteTime((CFDateRef)date);

	// Convert the time interval to a long date
	LongDateTime longDate;
	UCConvertCFAbsoluteTimeToLongDateTime(timeInterval, &longDate);

	// Build the descriptor
	return [self initWithDescriptorType: 'ldt '
								  bytes: &longDate
								 length: sizeof(longDate)];
}

@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: How do I hide app and get notified when it unhides?
  • Next by Date: Re: NSXML and DTD
  • Previous by thread: Re: Anybody who could help me with any of these....Plz Reply ASAP
  • Next by thread: Re: Using NSAppleEventDescriptor with NSDates
  • Index(es):
    • Date
    • Thread