INTERACT FORUM

Please login or register.

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

Author Topic: Formatting Date and Time!  (Read 1903 times)

Jaguu

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1336
Formatting Date and Time!
« on: May 09, 2008, 04:22:10 am »

FormatDate([Date, 0],yyyy-MM-dd  h-m)
FormatDate([Date, 0],yyyy-MM-dd  hh-mm)
do not seem to work!

Want to rename files according to the following format "yyyy-MM-dd hh-mm". Although the date field displays the time, it is not possible to format the time in the FormatDate expression. Any Help?

Would like to rename my photos according to Year-Month-Date Hour-Min-Sec!

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9133
Re: Formatting Date and Time!
« Reply #1 on: May 09, 2008, 04:52:46 am »

I mentioned this several months ago, around the time that the now() function was introduced, and was told that there is no capability for formatting the time values.

How about your [date (filename friendly)] field?

Mine outputs as yyyyMMddhhmmss, and the following expression:

mid([date (filename friendly)],0,4)-mid([date (filename friendly)],4,2)-mid([date (filename friendly)],6,2) mid([date (filename friendly)],9,2) mid([date (filename friendly)],11,2)

returns the string you're after.
You can either use it to create a calculated database field, and then use that in your rename rule, or incorporate the expression string directly into the rename rule itself.
If it's something you might use regularly, I'd recommend creating the library field for the sake of simplicity and safe keeping.

-marko.

Jaguu

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1336
Re: Formatting Date and Time!
« Reply #2 on: May 09, 2008, 06:53:58 am »

Thanks Marko for your help,

I created a calculated field "Date Exif" with your expression. Also added seconds to it. As far as I understand MC12 stores the Exif Date in the "Date" field. In this way I get a unique image filename which comes in very handy.

Strange that the hh, mm, ss are not being supported in the formatDate expression as one would expect. One wastes about two hours to find a solution for such a trivial thing. ?
Logged

Cmagic

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1196
  • Enjoying life with a little music....
Re: Formatting Date and Time!
« Reply #3 on: November 13, 2008, 05:00:10 am »

Hi Folks,

Thanks Jaguu for asking and Marko for replying.

I was also trying to format hours and minutes using FormatDate() for the exact same purpose.
Not very elegant a solution, but working.

Have a nice day,

Christian
Logged
Until the color of a man's skin is of no more significance
than the color of his eyes.
Bob Marley (War)
Pages: [1]   Go Up