spacer graphic


Be Developers:
Put your banner here!

spacer graphic x10icon graphic [Bar]

Time Is Relative


Last week we gave you a peek at some of the functionality in the BeOS Find function, that lets you search for all of today's mail, no matter what day "today" was. This week, a variety of different ways to express dates and date ranges in the Find function.

There are a number of ways to enter dates and times which are "relative" to the current date and time. That is to say, when you do a Find using the criteria described below, your Find will be based on whatever the date and time is when you perform it, plus or minus the modifier you enter. This lets your saved Queries "move" their date criteria forward in time, so that they are always up to date.

As we described last week, the BeOS understands the word "yesterday". It also understands "today" and "tomorrow". And it understands the days of the week ("monday", etc.), "hour", "week", "month", and "year", to which you can add either "last" or "next" as a modifier. So to search for files created in the last 7 days, you can search for files modified after "last week".

Find Panel: find last week's files

But that's not all! You can also use the terms "minutes", "hours", "days", "months", and "years" with positive or negative numbers (integers only), for example, searching for "-7 days" is the same as the "last week" modifier described above.

When there is a choice of how to interpret a date, the BeOS assumes you want a time after the current time. For example, if today is Wednesday and you just give a time of "monday", the BeOS will interpret that to mean next Monday. If that's not what you want, you may have to be more explicit (use "last monday") or you may have to use a relative time format like "-2 days".

You can also use somewhat more formal date formats, such as...

1/15/98 1pm
Jan 15th 9:00pm
Thursday January 15th
10am Thursday

They all work, and in fact we've added understanding of about 10 new formats to the BeOS that you'll see in the next release. So the different ways you can use to enter a date will only increase over time!

To provide this flexible date interpretation the BeOS Find function, and many other time-related functions in the BeOS and in third-party applications, makes use of a collection of built-in date routines called parsedate(). Anything that uses this routine will allow you to enter times and dates, or ranges of the same, in the casual formats described above. So if there's a date field in some application, try experimenting, and see if it's smart. If it is, this Tip will come in very handy with that application, too!

Finally, the definitive reference to the BeOS' parsedate() functionality is the Be Newsletter article Buried Treasures..., by the Be engineer who wrote the support. This article, while written for programmers, is still interesting and useful to technically inclined users who want even more information than this week's Tip. Plus you can see where I stole my material from (thanks Dominic!).

Copyright © 1999 by Be, Inc. All rights reserved. Legal information (includes icon usage info).
Comments, questions, or confessions about our site? Please write the Webmaster.