INTERACT FORUM

Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: DopeyJones on July 06, 2009, 01:57:46 pm

Title: Can I include seconds in "import date" and "creation date"?
Post by: DopeyJones on July 06, 2009, 01:57:46 pm
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)
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: Matt on July 06, 2009, 02:16:36 pm
I don't think you can, but seconds are preserved and honored during sorting.
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: DopeyJones 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?
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: marko 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 (http://wiki.jrmediacenter.com/index.php/Media_Center_expression_language#Mid.28....29:_Retrieves_specified_characters_from_a_value.) 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:
(http://www.theganghut.co.uk/pics/ia/14/importdatewithseconds2.jpg)
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.
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: DopeyJones on July 25, 2009, 08:40:33 am
Hey! Sorry for not discovering your reply, I'll check it out :)
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: DopeyJones 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?
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: marko 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.
Title: Re: Can I include seconds in "import date" and "creation date"?
Post by: MrC 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.