INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: "Today" vs 'last 24 hrs`'?  (Read 1544 times)

joh

  • World Citizen
  • ***
  • Posts: 100
"Today" vs 'last 24 hrs`'?
« on: August 02, 2009, 04:02:33 am »


Selecting Date Imported = Today seems to select items imported during the last 24 hrs. How do I select so that Date Imported is equal to today's date?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8941
Re: "Today" vs 'last 24 hrs`'?
« Reply #1 on: August 02, 2009, 05:19:42 am »

That one always irritated me too, especially as the same applies to [last played]. Here's how I achieved results for today to really be results from today, rather than the past 24 hours:

Step 1. (Get todays date into the library)
On my "UK English" PC, MC produces [last played] and [date imported] values in the format: "dd/mm/yyyy HH:MM"
Yours may be different, so be sure to check, as we are going to create a new library field using the "Day/Month/Year" data, and it is crucial that the data is placed in the same order that MC uses in its played and imported fields.

To create a new library field called "Current Date", go to: "Tools > Options > Library and Folders > Manage Library Fields"
Click on the "Add New Field" button and MC will prompt you for a field name. Enter the words Current Date and click OK
Select "Calculated Data" and paste the blue text into the "Expression" field: formatdate(now(),dd//MM//yyyy)
Ensure that the Day, Month and Year values are placed in the same order as used by MC on your system
Once you're happy, press the OK button.

Step 2. (search for files imported/played today)
We now have todays date in the library, which means that we can write a search string to compare [date imported] or [last played] with [current date]:

Imported today: [=isequal([date imported],[current date],8)]=1
Played today: [=isequal([last played],[current date],8)]=1

The blue text above can be used in various places such as a smartlist rule, a search list pane rule, the search bar in the top right, etc. etc..

Step 3. (Optional)
One of the biggest gripes I hear with regards to expressions is that the syntax is a pain to remember. If that's you, then why not go one extra step, and create another two "calculated data" library fields using the same steps as above. Call one "Played Today" and the other, "Imported Today".
[Played Today] will use the expression: isequal([last played],[current date],8)
[Imported Today] will use the expression: isequal([date imported],[current date],8)

Now, when searching for these files, all you need to use is: [played today]=1
No nasty syntax to remember :)

regards,
-marko.

joh

  • World Citizen
  • ***
  • Posts: 100
Re: "Today" vs 'last 24 hrs`'?
« Reply #2 on: August 02, 2009, 03:48:47 pm »


Absolutely perfect, Marco! Works like a charm!
Thank you so, so much for taking the time to explain this!
BTW: would it not make sense to have a system constant for current date?
Greetings from Sweden /OLle
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8941
Re: "Today" vs 'last 24 hrs`'?
« Reply #3 on: August 02, 2009, 07:15:37 pm »

You're welcome.

Another thing you can do with "Now()" is use it to add the current Day, Date and Time to the player display...

If you click on the player display bar, you get the option to customise it. The options presented are pretty self explanatory.
Add the following expression where you would like it to appear:
formatdate(now(),dddd dd//MM//yyyy)  padnumber(formatdate(now(),hour),2):padnumber(formatdate(now(),minute),2)

and MC will turn it into this:


-marko.

Pages: [1]   Go Up