Ah, OK. It looks like
date.weekday() isn’t locale compliant. But, you could get around that by using a look-up table.
First I make a note “lDays”. The lowercase ‘
l’-prefix is to remind me this is a look-up table note and give it a tilte i’m not likely to re-use for another note. the exact name doesn’t matter as long as later code looks up the right note! In this note’s $MyList, i add this loo-up table:
The numbers aren’t a sequence but values returned by
.weekday. Now i make a new note (tiytle doesn’t matter) and give it Key Attributes of $MString and $MyDate so we can see if thinks work. I set $MyDate to ‘today’ (17 August 2020 for later readers of the thread) and I add a stamp:
$MyString = $MyList("lDays").lookup($MyDate.weekday);
As today is Monday here in England we’d expect
$MyDate.weekday to return a value of
11. The stamp then fetches the $MyList value for the lDays’ note, which has the day number-to day name lookup table. The result is that $MyString is “Segunda-feira” which is Monday in Portuguese, if google is to be believed! You could do the same for month names as well, by copying the same general model.
- You only need a single copy if the look up table so put the note in a safe corner of your document and give it a title ($Name) you will not then use for something else.
- If you are going to look at $MyList across the whole document for some action code reason, you could give this it’s own attribute $DayList so nothing else uses that attribute name.
- If you do the latter you could have a $DayList and $MonthList and have one note store both look-up tables.