How to get month name in jasper studio expression editor - jasper-reports

I am using this command to get the date in jasperstudio expression editor
new SimpleDateFormat("dd.MM.yyyy").format($F{day_date})
This will return date value example like 01.01.2010 however i want the month to have a name like 01.Jan.2010 -- please advise

In your specified format "dd.MM.yyyy", MM gives you the month as a number.
You can use "dd.MMM.yyyy" to get an abbreviated month name.
Similarly, if you need the full month name you can use "dd.MMMM.yyyy"

Related

How do I build an an expression using ADF expression language to dynamically generate date in yyyymmdd format for a speciific time zone?

I want to do something relatively straightforward please help I'm stuck
Given today's date is 02 May, 2021 in my current timezone (Pacific Standard Time), build the string 20210502 (yyyymmdd format) dynamically.
What is the simplest way to do this in ADF? I tried following but returns error invalid expression:
#substring(formatString(getutcdate()),0,8)
I'm also not sure how to make it flexible so I can enter a different timezone if I want like Pacific Standard Time.
You can create a timezone variable and pass that value to convertFromUtc or convertTimeZone function. And you can choose format as you need. Here is the format specifiers list.
You can follow this:
expression:#replace(split(convertFromUtc(utcnow(),variables('timezone'),'u'),' ')[0],'-','')
Output:

Google Sheets function "=Year(2001)" returns 1905

When I enter =Year() with any year as argument (e.g. 2010), I always get 1905 as a result
At first i thought that my cell reference is broken, but it also happens when I enter the year directly into the formula.
The same thing happens when I enter =TEXT(2010;"YYYY") --> 1905 ???
What am I doing wrong?
You need to write
=YEAR(DATE(2010,1,1))
What 2005 is equivalent to
=INT(DATE(1905,3,19))
YEAR takes an integer value, DATE will convert for you the year, month and day to an integer.

How to set default parameter as 7 days ago to different date format on ssrs

I have default parameter and this parameter shows me 7 days ago with the expression below:
=DateAdd("d",-7,CDate(Format(Today(), "MM/dd/yyyy")))
But my report just running without error while the customer using "MM/dd/yyyy" time format.
Is there a way to use this parameter ALSO with "dd/MM/yyyy" format?
I would like to set a parameter to show 7 days ago but ı would like to use this parameter with both time format.
Thanks
Don't use the Format. Just put =DateAdd("d",-7,Today()). It will automatically take the Format according to System's format.
Firstly, the format part of your expression is redundant and misleading - don't use it
=DateAdd("d",-7,Today())
Secondly, you don't have any choice of how SSRS displays it's datepickers. It shows american format only (M/d/Y)
A date is a value and values do not have a format. A date is displayed and has to be entered in a format that depends on the language settings of your browser. Using a date picker, you even don't have to care about the input format. So, just use an expression that calculates the desired value:
=Today.AddDays(-7)

Cakephp 3 i18nFormat string for the number of weeks in a specified date

How to get number of week for specific date in cakephp 3?
$this->mydate->i18nFormat('yyyy-MM-dd') will display year-month-date.
But what about string format for week number?
Thanks.
Have a closer look at the docs for Cake\I18n\Time::i18nFormat(), it tells you what you can pass as the format, and where to find a list of the accepted formatting patterns:
[...] You can either pass IntlDateFormatter constants as the first
argument of this function, or pass a full ICU date formatting string
as specified in the following resource:
https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax.
Cookbook > Date & Time > Formatting > Cake\I18n\Time::i18nFormat()
So long story short, the pattern letter for the week of the year is w, or ww if you want a leading zero, and for the week of the month it's W or WW.

Localizing date on SSRS

I'm using the d Format on the date field
So when the report's Language is on German(de), July 22, 2012 appears as:
22.07.2012
When I switch the report's Language to English(en), July 22, 2012 appears as:
7/22/2012
How can I make the English date appear as 07/22/2012? i.e. the dates should appear as two digits regardless of the month being two digits or single digit
You can use custom date format such as MM/dd/yyyy. If you need custom format only for English report then you can use expression =IIf (User!Language = "en", "dd\mm\yyyy", "d")
You can use the following expression in you report to show the date in dd/mm/yyyy format. Following screenshot shows date time with and without modification to the expression.
Expression:
=string.Format("{0:MM/dd/yy}",Fields!ModifiedDate.Value)
Without modification
With Modification:
Hope this helps!