{{date|date('Y-M-d')}}
When doing this, the month is being returned like 'jan.' 'fev', and not 'jan', 'fev'. Has anyone seem something like that?
This seems very strange. I can't reproduce the error. Check out this Twig fiddle to see the result of executing the code that you posted: http://twigfiddle.com/zadbqa I can't see the dot in the month names.
Where does the date variable come from in your template?
Related
currently I am working with a Logic App, I want to set the hours to a given DateTimeFormat to 00:00:00 with a Variable. After that I try to add an int variable as hours with it, but that doesn't work. Any ideas?
formatDateTime(addHours(utcNow(), -utcNow().Hour + variables('Daytime')), concat('yyyy-MM-ddTHH:mm:ss', variables('DateTimeOffset')))
It would be nice to know what values the variables have in them because without it, it's not as easy to provide a complete answer, but, bottom line, you can't use + like you have in the expression.
If you want to add and minus, etc., you need to use the inbuilt function add.
The expression builder is a function based approach.
Without knowing exactly what you want to achieve, something like this will help you along ...
concat(addHours(formatDateTime(utcNow(), 'yyyy-MM-dd'), 6, 'yyyy-MM-dd HH:mm:ss'), '+06:00')
... but will need to be cleaned up.
You also need to replace my hardcoded values with your variables.
I'm trying to output a template variable inside the if statement in ModX, but it gives no output.
I have multiple pages with links to articles and the point is to only output template variable content on the first page but not the others.
// This gives no output:
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]
// This outputs "yes" on the first page and "no" on others:
[[!#get.page:is=`1`:or:is=``:then=`yes`:else=`no`]]
I've even tried this, but it still does not give any output. I guess the problem is not about the output modifier:
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=`[[*content]]`]
I'm using ModX Revo 2.7.0
Any help is appreciated, thanks in advance!
Actually in your case missing a double closing angle bracket "]]"
[[!#get.page:is=`1`:or:is=``:then=`[[*content]]`:else=``]]
The `or:is=` is matching against an empty state. Unless that is intentional you should be able to remove it. Also, the `:else=`` is the default state, so, you don't need that either.
The following should work and you'll have cleaner code:
[[!#get.page:is=`1`:then=`[[*content]]`]]
I have installed the INTL Bundle for Sonata which provides a few twig helper functions for currencies.
The twig function is number_format_currency('currency_code')
If I have a value such as 2000000, I would like to be displayed as £2,000,000, currently when I run 2000000|number_format_currency('GBP') it returns £2,000,000.00 - so with a trailing 2 0s after the decimal point.
Ive dug in to a little and can see its using symfony's number formatter and it supports a few constants passed in as array, it seems to only support 'FRACTION_DIGITS', 'ROUNDING_MODE', 'GROUPING_USED'.
Out of these FRACTION_DIGITS seems to make sense to change to 0, to this I have tried:
2000000|number_format_currency('GBP',{'FRACTION_DIGITS':0})
But i'm getting the same number with the 2 decimal points at the end, i'm sure its an easy fix maybe i'm passing the array in wrong or something but its had me stumped for a little while, can anyone help?
I am facing a problem on Cognos 10 with the LIKE function.
I have a varchar field named EOM_DATE which contains the end of months values, for example: 2017_01, 2017_02, etc.
I want to build a query like this:
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE ('2016%', '2017%', '2018%')
because I want that only the specified years to show.
Any solution?
I have tried different solutions using LIKE, STARTS WITH and even IN, but none of them seems to work.
You have to break it out. The pattern you are using only works with IN and IN doesn't support wildcards.
Try this:
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2016%'
OR
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2017%'
OR
[RiskDM2].[ADAV_RISKDATAMART].[EOM_DATE] LIKE '2018%'
This is effectively a long-form of IN, but it allows you to use the LIKE operator.
Example
www.domainname.com/page-param1-param2.html
...it will work fine but
www.domainname.com/page-param-1-param2.html
... here param one have the data like param-1 this time url is not working.
How do I get this to work?
Looks like you should use a different syntax, perhaps - there's no way to tell whether it should interpret the "1" as part of the first parameter or not. Alternatively, you could escape the - in "param-1" by encoding the - as "%2D" (no quotes).
So for example, your link would be: http://www.domainname.com/page-param%2D1-param2.html