INTERACT FORUM

Please login or register.

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

Author Topic: Can I include seconds in "import date" and "creation date"?  (Read 3057 times)

DopeyJones

  • Junior Woodchuck
  • **
  • Posts: 64

The import date currently shows in the format "29-05-2009 13:35" (as an example). Can I edit it and include seconds in the column too? (so that the field would be 29-05-2009 13:35:48)
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41926
  • Shoes gone again!
Re: Can I include seconds in "import date" and "creation date"?
« Reply #1 on: July 06, 2009, 02:16:36 pm »

I don't think you can, but seconds are preserved and honored during sorting.
Logged
Matt Ashland, JRiver Media Center

DopeyJones

  • Junior Woodchuck
  • **
  • Posts: 64
Re: Can I include seconds in "import date" and "creation date"?
« Reply #2 on: July 06, 2009, 02:24:07 pm »

Thanks for the reply.

Well that's good at least. Could it possibly be build into the next update?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8936
Re: Can I include seconds in "import date" and "creation date"?
« Reply #3 on: July 07, 2009, 02:30:26 am »

How badly do you want it? It's possible right now, but requires a little leg work to realise:

First, create a new library field to produce the data. This new field won't be needed in any view scheme, it's just a hop to your goal.
To add a library field, choose: "Tools > Options > Library and Folders > Manage Library Fields" and click on the "Add Field" button.

You can call your field anything you like, though simplest is best as it'll save on typing in the next steps. Select "Calculated data" and paste the blue text into the expression field...
formatdate([date imported,0],filename)
and press OK.

The contents of this new field will be your "Date Imported" including seconds, using the following format: YYYYMMDD-HHMMSS

You can then create a second field, or an expression column, or an expression pane, using the mid() function to arrange the info in your new field any way you choose.

I used an existing library field here I call [test field 2] for step one above, and then added an expression column (right click on a column header and choose "add expression column") to the list to give:

The expression used to populate the pane goes like so:
mid([test field 2],6,2)-mid([test field 2],4,2)-mid([test field 2],0,4) mid([test field 2],9,2):mid([test field 2],11,2):mid([test field 2],13,2)

So, like I said, it's there, but how badly do you want it? :)

-marko.

DopeyJones

  • Junior Woodchuck
  • **
  • Posts: 64
Re: Can I include seconds in "import date" and "creation date"?
« Reply #4 on: July 25, 2009, 08:40:33 am »

Hey! Sorry for not discovering your reply, I'll check it out :)
Logged

DopeyJones

  • Junior Woodchuck
  • **
  • Posts: 64
Re: Can I include seconds in "import date" and "creation date"?
« Reply #5 on: October 25, 2009, 04:47:58 pm »

It doesn't work for me. The field shows:
Quote
im-eT-[Dat I:mp:or

Btw. Is there any way to edit the already existing fields instead of adding new ones?
And how do I delete and edit created expression columns?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8936
Re: Can I include seconds in "import date" and "creation date"?
« Reply #6 on: October 26, 2009, 02:25:50 am »

To delete the column(s)? (should only be one, no?) right click on the column header and it should be at the top of the list with a tick beside it... click on that entry to remove the column. To edit it's expression, choose the "Edit" option seen when right clicking on the column header.
As far as existing fields are concerned, you can only edit fields designated as "User" fields. In this scenario, I strongly advise creating a new field as its use is exclusively internal as far as you are concerned, and the fields provided by default have a broad general purpose. Sure there may be some you never intend using, but then, never, is a long time :)

Looking at the results you posted, it looks as though the library field you should have created in step one above has not worked. Just to recap:

1. Create a new "calculated data" library field using the following expression: formatdate([date imported,0],filename)
2. In a view, try adding (temporarily) the field you just created as a column. It should show the "Date Imported" in the following way: YYYYMMDD-HHMMSS
3. If step two shows as expected, remove that column, then add an expression column that references this new field, extracting the required information in the order you require it. If your data is formatted as shown above, then the following expression :
mid([test field 2],6,2)-mid([test field 2],4,2)-mid([test field 2],0,4) mid([test field 2],9,2):mid([test field 2],11,2):mid([test field 2],13,2)
will create a column populated as shown in my screenshot above. Remember to substitute each instance of "[test field 2]" with the name of the field you created in step 1 inside square brackets.

If you're still having trouble getting it to work, post the steps you've taken and it'll be easier to see where I may have taken something for granted (I've got previous for that ;))

-marko.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Can I include seconds in "import date" and "creation date"?
« Reply #7 on: December 27, 2011, 12:25:52 pm »

Old thread, but it is a good example of where Regex() can be useful too:

   regex(formatdate([date imported,0], filename),
       /#^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})$#/, -1)Year: [R1], Month: [R2], Day: [R3], Hour: [R4], Min: [R5], Sec: [R6]

This grabs all the date/time components.  You can use the captured components you want, ignore the captures you don't want.  If you only wanted seconds, simplify the expression to capture only seconds:

   regex(formatdate([date imported,0], filename),
       /#(\d{2})$#/, 1)

Create an expression column and give it a try.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up