I have the following XAML code:
<Label Text="{Binding startTime, StringFormat='{0:MMM d, yyyy }'}" />
which renders June 18, 2017
I'd like to create a string that renders 18 June 2017 when the culture is not US.
Any ideas on how to do that?
MMM will give you an abbreviated month name, you have to use the MMMM if you want to get the full month name. More from MSDN https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
Your XAML code should look:
<Label Text="{Binding CurrentDate, StringFormat='{0:d MMMM yyyy}'}}" />
Related
I am working on a contract and need a date to be the current date if {month3} is after the current date.
I have tried it every way imaginable, I have 2 scenarios where if {month3} is after the current date it prints {month3}, but if {month3} is prior to the current date it prints the current date and hides part of the text above it.
It works on one but not the other, Go easy on me, it's my first post!
IF TOTEXT({Month3},"MMMM dd, yyyy") >= TOTEXT((Currentdate),"MMMM dd, yyyy") THEN
TOTEXT((Currentdate),"MMMM dd, yyyy")
ELSE
TOTEXT({Month3},"MMMM dd, yyyy")
{Month 3} = 7/30/2020
From contract signing to July 30, 2020
From July 07, 2020 to the start of the official event date
the other one is right
{month3} = 5/18/20
Top sentence is hidden and it says:
From July 07, 2020 to the start of the official event date
It's because you compare text-strings instead of dates. Remove the TOTEXT-function and set the date format directly on the properties of the formula field.
IF {Month3} >= Currentdate THEN
Currentdate
ELSE
{Month3}
I am trying to implement a date on Google Sheets in a way that it is translated to a different language programatically:
If I have =TEXT("01/01/2020","DD MMMM YYYY") I get 01 January 2020.
If I change my Google sheets language settings to spanish, I will get 01 Enero 2020.
However, I am looking for some =TRANSLATE('ES', TEXT("01/01/2020","DD MMMM YYYY")) so even though my settings are set to English, I still get Enero instead of January.
Is there a way to do that?
try:
=GOOGLETRANSLATE(TEXT(TODAY(), "dd mmmm yyyy"), "en", "es")
then:
=PROPER(SUBSTITUTE(GOOGLETRANSLATE(TEXT(TODAY(), "dd mmmm yyyy"), "en", "es"), "de ", ))
You could try this but I don't know how accurate it is:
=GOOGLETRANSLATE(TEXT("01/01/2020","DD MMMM YYYY"), "en", "es")
I have news items, grouped by year and month. Here the code:
<f:groupedFor each="{paginatedNews}" as="groupedNews1" groupBy="yearOfDatetime" groupKey="year">
<f:groupedFor each="{groupedNews1}" as="groupedNews" groupBy="monthOfDatetime" groupKey="month">
<div style="border:1px solid blue;padding:10px;margin:10px;">
<h1>{month} {year} </h1>
<f:for each="{groupedNews}" as="newsItem">
<f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}" />
</f:for>
</div>
</f:groupedFor>
</f:groupedFor>
Unfortunately, month and year are displayed in numbers in frontend, e.g.
03 2019
..(some news items)
02 2019
...
01 2019
However, what I need is this:
March 2019
...
February 2019
...
January 2019
How can I achieve this?
On the original EXT:news this method has been used:
Look at the template EXT:news/Resources/Private/Templates/News/DateMenu.html
<f:translate key="month.{month}" />
on the EXT:news/Resources/Private/Language/locallang.xlf you will find:
<trans-unit id="month.01" xml:space="preserve">
<source>January</source>
</trans-unit>
And so forth.
I am trying to change a simple date format "1/24/2016" to " Tuesday, Jan 24 2016"
sheet.getRange("A2:A10").setNumberFormat("EEE, d MMM yyyy");
prints:
"EEE, Jan 24 2016"
This is an undocumented feature
you can use:
range.setNumberFormat("DDD, MMM dd, YYYY");
For more details you can see the issue report here:
https://code.google.com/p/google-apps-script-issues/issues/detail?can=2&start=0&num=100&q=setNumberFormat&colspec=Stars%20Opened%20ID%20Type%20Status%20Summary%20Component%20Owner&groupby=&sort=&id=4175
Consider the following code:
<cfset lateDate = createDate(2014,12,8) />
<cfset currentdate = createDate(2015,4,15) />
<cfdump var="#lateDate#" />
<cfdump var="#currentdate#" />
<cfdump var="#dateCompare(currentdate,lateDate)#" />
Output on my machine is:
{ts '2014-12-08 00:00:00'} {ts '2015-04-15 00:00:00'} 1
Question 1: Why is the month switched on the two dates. (month/day). The spec says create date is yyyy,mm,dd and yet either CF switched them or it's displaying them switched.
It's doing the dateCompare correctly so what is going on. Have I been staring at this too long?
I think you have been looking at it too long. Both of those are valid dates and the month is not being switched. One of your dates is April 15, 2015 and the other is December 8, 2014. I assume you were thinking August 12, 2014 for that date. Then your code should be createDate(2014,8,12). Right?
The dateCompare function only tells you if the first date is earlier or later than the second date. For both of your dates, the correct one and your assumed one, the first date is later than the second.
I think the code is working correctly. As in:
createDate(2014,8,12) <!--- August 12, 2014 --->
createDate(2014,12,8) <!--- December 8, 2014 --->
createDate(2015,4,15) <!--- April 15, 2015 --->
dateCompare "April 15, 2015" "December 8, 2014" returns 1
dateCompare "April 15, 2015" "August 12, 2014" returns 1