Date format not working as expected

What I’m trying to do

I’m trying to Link my todays daily note on my Homepage/Dashboard using the plugin Dataview.

This is my code:
="[[" + "Personal vault/Daily notes/" + dateformat(date(now), "dd-MMM-yyyy") + "]]"

This is the response of the code:
Personal vault/Daily notes/26-Sept-2023

The response I want is:
Personal vault/Daily notes/26-Sep-2023

So the month should be “Sep” instead of “Sept”

Things I have tried

I already tried the following as well:

="[[" + "Personal vault/Daily notes/" + dateformat(date(now), "dd-LLL-yyyy") + "]]"

This is the response of this code was the same as before:
Personal vault/Daily notes/26-Sept-2023

Not sure if this will help but according to the site ( linked to from the Dataview documentation concerning the tokens used for dateformat, the token MMM is month as an abbreviated localized string. It doesn’t necessarily say that the abbreviation matches the number of characters. Good luck!

1 Like

Is there a way to limit the response of the MMM or LLL to 3 characters?

I’m not sure about your use case, but perhaps you could use substring. After searching elsewhere, I saw many posts within various other softwares where people were having issues with MMM producing Sept. So, I imagine there are definitely workarounds.

1 Like

Using substring() as @I-d-as mentioned, maybe this could work:

="[[" + "Personal vault/Daily notes/" + join(list(date(today).day, substring(dateformat(date(today), "MMMM"),0, 3), date(today).year),"-") + "]]"

It’s not very elegant but I had to divide the date in day, month and year parts stored as items of a list.
For the month part, I’ve formatted it as the month’s full name from which I only keep the first 3 characters using substring().
The list containing each date parts is then joined by "-" to re-create the date.

I’m not very dataview fluent :sweat_smile: , but this seemed to work from my side of the screen.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.