Where and how can I change the date format


(LE) #1

Hi.
I want to change the date (as shown in the attribute lines of a note) from »24.03.34, 17:59« to »24.03.1834«.
How can I do that.
Thank you.


(Mark Anderson) #2

I’m assuming you are referring to what Tinderbox calls a note’s ‘Key Attributes’ table. The formatting of Date-type attributes is based on the users macOS preferences - i.e. is set outside Tinderbox. Based on this you have a small range of choices in Document Settings, Text.

If you are not happy with any of the pre-offered choices (I can’t tell as your default implies a different OS locale to mine) you can set $KeyAttributeDateFormat to use a date format of your choice


(eastgate) #3

Often, when people want to change the date format they use in Tinderbox, the best place to do so is in System Preferences and apply the change throughout the system.

For example, one very common request comes from people who study history. They need four-digit years, and the system defaults for short dates in many countries use two-digit years. If you’re a historian, this is going to trip you up all the time in all sorts of places, not just Tinderbox, and your casual correspondents, if they notice the change, will we you write 03.05.2017 on top of your mail and say “what a precise fellow my friend is!”

So, change your short date format throughout and everything gets better.


(LE) #4

Thank you, Mark & Mark.
Yes, it has to do with history that I want to see the first two digits of the year.
The system prefs offer three time formats and Tinderbox takes obviously the short format. Thank you for that hint.

But I like the two-digit short format for my daily use. So I would rather tell Tinderbox »Don’t take the short format but the middle time format.« Is that possible?

And how do I get rid of the comma-separated time stamp? (It must be a crazy coincidence when William Morris was born the same hour and minute that I pressed »OK«.)

But of course I will try and play with $KeyAttributesDateFormat.


(Mark Anderson) #5

I think this distills down to three linked questions:

  1. Can I suppress the time element of a Date-type attribute (i.e. part of a date-time value) when shown in a the key attributes (KA) table of a note?
  2. Can I use different date-time formats for the same attribute in different notes?
  3. Can I use different date-time formats for the different attributes in the same note?

Before answering these, it is important to understand attribute value inheritance in Tinderbox. If this is new to you please look at this article. In this case, the chain is:

OS date-time format settings (affects all TBXs)
Doc Setting, Text tab, KA data format pop-up (affects all KA use of Date attributes in current TBX doc)
$KeyAttributeDateFormat doc-level default (default is blank so simply inherits)
$KeyAttributeDateFormat doc-level custom value (doc uses custom format for all date KAs throughout doc)
$KeyAttributeDateFormat note-level custom value (setting trumps inherited value only for this note)

#1. Yes, if the OS-derived formats and variants of that offered (as doc-wide variants for all Date attributes) don’t work you need to resort to setting $KeyAttributeDateFormat (I refer you again to my links above). If you set a custom date format as the attribute’s doc-level value via the Document Inspector’s System or User sub-tabs, it will change the display of Date-Time data throughout the TBX doc but for all Date type attributes.

#2. Yes, do this by setting a different $KeyAttributeDateFormat value as note level. This trumps inheritance and affects all Date-Time KAs but only in that note.

#3. No, because at described in answer #2, even a local setting affects all Date-type attributes. There is currently (v7.0.3) no method to customise the date-time display format of different Date attributes in the same note KA table.

Thus in summary, I think the answer is ‘No’, but hopefully the reason can be understood from my description of how the system works.

But, do you need a Date field, if what you want to see/store is a the text string ‘24.03.1834’. One work around is to either just use a String attribute instead of a Date one or use both and use the string version for your KA, but still have the date one for doing date-based arithmetic or for use in Timeline view. It is not too difficult to move date’s in and out of strings and dates - though if doing so I’d always use 2-digit days and months and 4 digit years (before/after year (100 (B)CE, anyway). If you add a new user String attribute ‘MyString@’ to a new doc, add a note and set $MyString, $MyDate and $MyString2 as KA and then apply this rule:

$MyString="24.03.1834";
$MyDate=date($MyString);
$MyString2 = $MyDate.format("D.M0.y");

You can see the effect. On my UK Mac system, $MyDate is dd/mm/yyyy hh:mm, but I’d expect yours to show as dd.mm.yyyy hh:mm (unless you’d changed any of the KA format setting as above!). These sort of format changes can easily be used as stamps or rules in prototypes to save you extra effort.

I think a combination of KA format settings and use of different attribute data types will solve your problem.


(LE) #6

Hi, Mark.
Thank you for your detailed explanation. I will dig into that stuff next weekend, but the above mentioned solution could be sufficient for me.