How to format short german day names with TYPO3 fluid viewhelpers and strftime? - typo3

strftime returns only three letter weekday abbreviations, like "Thu". In german, that doesn't make any sense, it's Mo,Di,Mi,Do,Fr,Sa,So, not "Fre"...
How do I set
<f:format.date format="%A, %d.%m.%Y">{item.date}</f:format.date>
So that it appears correctly with the german locale?

Just split it up and crop it separately...
<f:format.crop append="" maxCharacters="2"><f:format.date format="%A">{item.date}</f:format.date></f:format.crop> <f:format.date format="%d.%m.%Y">{item.date}</f:format.date>

Use only D in format. it's display only three letters. Like below
<f:format.date format="D">{item.date}</f:format.date>

Related

LibreOffice : how shall I change the names of the weekdays in date format

In LibreOffice, I wish to change the weekdays names to have something shorter.
In French, the date format "ddd dd/mm/yy" applied to today 2021-08-17 gives : "mar. 17/08/21". I would prefer "ma 17/08/21" to have narrower columns.
So I wish to change the existing weekdays names "lun., mar., mer., jeu., even., sam., dim." to something shorter : "lu, ma, me, je, ve, sa, di", through the format used by LibreOffice.
I played with French locales (Swiss French, etc.) but it is not satisfactory. I tried to change the list for the sort but it has no effect on the date format.
Is it possible to change the list LibreOffice uses for the weekdays ? How shall I proceed ?
You cannot do this with normal formatting (unless you require a change to the national date standard).
However, you can easily get the desired date representation using the TEXTE() and REGEX() functions.
=REGEX(TEXT(A1;"OOO JJ/MM/AA");"(..)([^\.]*\.)(.+)";"$1$3";"g")
Or shorter notation using LEFT() (GAUCHE()):
=LEFT(TEXT(A1;"OOO");2)&TEXT(A1;"\ JJ/MM/AA")
Remember to check that the cell format is French, otherwise you will get an error (not every language uses O-J-A characters)

What does T mean in "YYYY-mm-DDTHH:MM"?

I am trying to pull some data from Twitter, and the date format is "YYYY-mm-DDTHH:MM". What does T mean in "YYYY-mm-DDTHH:MM"?
The T isn't substituted for a value, it's a character used in the output to designate that the second part is a Time.
For example: 2021-04-20T13:03
The format is part of the ISO 8601 international standard.

12h cycle AM/PM in Fluid

In TYPO3 I am using the News Extension to create an Event. In my List view I am using the following code snippet to show the End Time of the Event.
<f:format.date format=" - %H:%M Uhr">{newsItem.eventEnd}</f:format.date>
Which results in " - 20:00 Uhr" (German Language, hence the "Uhr").
I want a Format that switches that time to " - 08:00 PM" for the English translation, I am assuming that is not possible in Fluid since my searches have no result. Is there any workaround?
You can put your format into a locallang file. There it's possible to change the format related to the language.
<f:format.date format="{f:translate(key:'dateFormat')}">{newsItem.eventEnd}</f:format.date>
The date format viewhelper uses the same format as the default PHP date and strftime functions, so anything you can use %I:%M %p to get 08:00 PM. See http://php.net/manual/en/function.date.php and http://php.net/strftime for more about this.

$Date.Format on Silverstripe 4 Template

I have a date in the database with this format "YY-mm-dd". On the template I want it in this format: dd.mm.YY
Usually it would work with $date.Format('d.m.Y')
But not in Silverstripe 4. It converts from 2018-05-08 to 8.0.2018. Only the year is correct. Was there a change. I didn't find anything in the Documentation
Date formats in SS4 were changed from PHP date formatting to CLDR date formatting (changelog link):
Changed Format() method to use CLDR format strings, rather than PHP format string. E.g. d/m/Y H:i:s (php format) should be replaced with to dd/MM/y HH:mm:ss (CLDR format).
You can use this to achieve what you want:
$Date.Format('dd.MM.y')
The guide mentioned in the previous answer regarding date formatting has moved. The new location for CLDR date formatting as used by Silverstripe 4 can be found here:
https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table

Struggling with dates formats, want YYYY-MM-DD

As an absolute beginner to SAS I quickly ran into problems with date formatting.
I have a dataset containing transaction with three types of dates: BUSDATE, SPOTDATE, MATURITY. Each transaction is represented on two lines, and I want BUSDATE and SPOTDATE from line 1 but MATURITY from line 2.
In the original set, the dates are in YYYY-MM-DD format.
DATA masterdata;
SET sourcedata(rename(BUSDATE=BUSDATE2 SPOTDATE=SPOTDATE2 MATURITY=MATURITY2));
BUSDATE=BUSDATE2;
SPOTDATE=SPOTDATE2;
IF TRANS_TYPE='Swap' THEN;
MATURITY=SPOTDATE;
RUN;
Problem is, this returns something like 17169 (which I guess is the number of days from a certain date).
How can I make it output in YYYY-MM-DD format - or is this approach wrong; should I first convert the date variables to some SAS date format?
if you have valid SAS dates, just add a FORMAT statement to your DATA STEP.
Format busdate spotdate maturity yymmdd10. ;
SAS dates are numeric variables. They represent the number of days since 1/1/1960. You use a FORMAT to display dates.
Adding to CarolinaJay's answer, you normally want to keep them as numeric format, since you can do math (like "# of days since date X") with them. However, if for some reason you need a character variable, you can do this:
date_As_char=put(datevar,YYMMDD10.);
Incidentally, YYMMDD10 will actually give you YYYY-MM-DD, as you asked for; if you want a different separator, see http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000589916.htm (YYMMDDxw. format) - if you put a letter after the last D, for certain letters, you get a different separator. Like, YYMMDDn10. gives you no separator, or YYMMDDs10. gives you slashes. YYMMDDd10. gives you dashes, just like omitting the letter would. This concept also applies to MMDDYY formats, and I think a few others.