• 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
Saying "today" in predicates, or, "in the last"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saying "today" in predicates, or, "in the last"


  • Subject: Saying "today" in predicates, or, "in the last"
  • From: Francisco Tolmasky <email@hidden>
  • Date: Fri, 14 Oct 2005 04:09:49 -0700

I'm using predicates in my program and I'd like to know if there is a way to say "today" without physically inserting todays date every time I want to use the predicate, as so:

[NSPredicate predicateWithFormat: @"date == %@", [NSDate date]]

I know you can also have predicate with replacement values, but again, every time I want to use the predicate I'd have to inform it of the new date. Is there any way to just say [NSPredicate predicateWithFormat: @"date == today"]?

The reason I want to know this is because I want to implement "in the last 5 days" or such a predicate, where a date would basically have a value added then compared against the current date, as so:

@"date+xdaysorwhatever <= today"

So if there is simply a better way of expression "in the last X whatevers" that would help also.

Thank you in advance,

Francisco Tolmasky
email@hidden
www-scf.usc.edu/~tolmasky


_______________________________________________ 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: Problem displaying accented characters in NSTextView
  • Next by Date: NSStream question
  • Previous by thread: Re: NSTableView and variable row heights problem
  • Next by thread: NSStream question
  • Index(es):
    • Date
    • Thread