Author Topic: Day as ordinal number.  (Read 175 times)

Offline Chrish_Photos

  • Newcomer
  • *
  • Posts: 5
    • View Profile
Day as ordinal number.
« on: November 28, 2017, 04:53:23 am »
Hello All
I'm trying to use code replacement to show the date as an ordinal number. IE 'April 2nd' instead of 'April 2'. (1st instead of 1 etc) The month is easy obviously, but how do I get the day like that.
thanks
Chris

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 17926
    • View Profile
    • Camera Bits, Inc.
Re: Day as ordinal number.
« Reply #1 on: November 28, 2017, 08:00:44 am »
Chris,

I'm trying to use code replacement to show the date as an ordinal number. IE 'April 2nd' instead of 'April 2'. (1st instead of 1 etc) The month is easy obviously, but how do I get the day like that.

In your Code Replacement text file you do something like this:

1[tab]1st
2[tab]2nd
3[tab]3rd
...
30[tab]30th
31[tab]31st

Do you understand the rest of Code Replacements (i.e. how to use them once you've written them)?

http://wiki.camerabits.com/en/index.php/User_Manual_Flat_View#Code_Replacement

-Kirk

Offline Chrish_Photos

  • Newcomer
  • *
  • Posts: 5
    • View Profile
Re: Day as ordinal number.
« Reply #2 on: November 28, 2017, 08:55:38 am »
Thanks Kirk

I do understand how the CR works, and have it pretty much sorted for this client.

I'm having the code insert the date and day of the Month from the image EXIF data, which is working fine. I just need the suffix placed automatically as well. Doing it with a manual code replacement for each day would be too slow to contemplate. I'm not sure why the client is insisting on this, but I suspect he is a grammar nazi/perfectionist.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 17926
    • View Profile
    • Camera Bits, Inc.
Re: Day as ordinal number.
« Reply #3 on: November 28, 2017, 09:19:47 am »
Thanks Kirk

I do understand how the CR works, and have it pretty much sorted for this client.

I'm having the code insert the date and day of the Month from the image EXIF data, which is working fine. I just need the suffix placed automatically as well. Doing it with a manual code replacement for each day would be too slow to contemplate. I'm not sure why the client is insisting on this, but I suspect he is a grammar nazi/perfectionist.

Use separate variables with Code Replacement for the lookups.

{monthname} \{day}\

The above should do exactly what you want and isn't tedious at all.  You can use the above in the IPTC Stationery Pad during Ingest and as soon as the images hit your hard drive they'll be dated the way the client asked.

HTH,

-Kirk

Offline Chrish_Photos

  • Newcomer
  • *
  • Posts: 5
    • View Profile
Re: Day as ordinal number.
« Reply #4 on: November 28, 2017, 11:11:23 am »
That's brilliant Kirk. I had to think about what you said and how it works for a while, but suddenly a whole new world of advanced code replacement has opened up.

Thanks for taking the time and effort to help.

EDIT: I've just realised, my original CR is based on BIB numbers that include 1 to 31. That means I'll have two of each number and I'm guessing the CR will use the first one it gets to.
EDIT: I changed the day to {day01} and made the CR 01(tab)1st. it worked like a dream.
All the best
Chris
« Last Edit: November 28, 2017, 11:21:53 am by Chrish_Photos »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 17926
    • View Profile
    • Camera Bits, Inc.
Re: Day as ordinal number.
« Reply #5 on: November 28, 2017, 11:28:00 am »
Chris,

Thanks for taking the time and effort to help.

You're welcome.

-Kirk