When I generate a report that expects two date parameters, I first see the dialog box titled 'Enter Values' and the dialog box contains two text boxes with its own date picker widget. However, once I pick a date and click 'OK', the date is formatted as 'dd/MM/yyyy'. Does anyone know if it is possible to configure the report in a way so that the date format matches Windows system locale short date format? Instead of just defaulting to dd/MM/yyyy?
Thanks!
The date format for the parameter can't be changed, at least as far as I know. If you want the date displayed in a different format, you can always create a formula:
"From : " & ToText(Minimum({?date}), "M-d-yy") &
" To :" & ToText(Maximum({?date}), "M-d-yy")
Or you can go into the File menu, click on Options and under the Fields tab, there is a button for Date. Click on that and you can choose the format under the Date tab. This is for CR 2008, so it may be slightly different for CR XI.
If You are trying to filter in your SQL on date range field then you can add castings on dates. Like
datarangeField between cast({?Start Date} as date format 'm-d-yy')
AND cast({?End Date} as date format 'm-d-yy')
Also, you are required to add these (Start Date and End Date) in your SQL Parameters during Adding the query.
For display you can use formulas and format field options.
Related
Yes, I know; this question has been asked thousands of times in hundreds of different places, but Google Sheets stubbornly refuses to let me convert a date such as "9/18/2004" to "2004-9-18". I select one or more cells whose date format is "dd/mm/yyyy", click on FORMAT, then NUMBER, then MORE FORMATS, then I select "More date and time formats", and then select the example "1930-08-05", and then nothing happens. Nothing changes. I need help with this. Here is a link to the problem column:
https://docs.google.com/spreadsheets/d/1gYdPcNO-Jq1SFUpdb88o7KKVqG5_ia9NpD_3T98CkEw/edit?usp=sharing
Thanks.
From Google:
Change locale and time zone
When you change the locale and time zone of a spreadsheet, it changes the spreadsheet’s default currency, date, and number formatting.
On your computer, open a spreadsheet in Google Sheets.
Click File and then Spreadsheet settings.
Under "General," click the "Locale" and "Time zone" menus to change your settings.
Click Save settings.
Changing the locale doesn’t change your language settings in Google Sheets. You can set the language in Google Account settings.
Worked for me :)
9/18/2004 is not a date. its text string. if you change it to 18/9/2004 then you have a valid date and you can apply your desired formatting
to quickly reformat it you may use:
=ARRAYFORMULA(TEXT(IF(ISNUMBER(A2:A*1), A2:A, DATE(
REGEXEXTRACT(A2:A, ".{4}$"),
REGEXEXTRACT(A2:A, "^\d+"),
REGEXEXTRACT(A2:A, "/(\d+)/"))), "yyyy-mm-dd"))
So this just worked for me:
Change settings as advised - but THEN:
Insert a new column
Copy all dates from the original column into the new on with "paste special" => "values only".
Then select all dates and format again as date. From there on I could sort according to date etc.
I'm trying to convert date from "text" to correct format. It is logged to Google Spreadsheets and I'm unable to use it to plot graphs.
This is the text format: February 3, 2018, at 11:21 AM
Time is not relevant, all I need is the date converted: DD/MM/YYYY.
I found a similar question where Gary's Student answered with a formula that looks like this for a different format:
=DATEVALUE(SUBSTITUTE(A1,MID(A1,FIND(" ",A1)-2,2),""))
(link to that question)
How can I use above formula (or something similar) so that text is converted to date?
Thanks in advance.
The , at portion of the string is keeping Google Sheets from recognizing it as a datevalue. Just remove it with the substitute function and wrap in datevalue function like so: =DATEVALUE(SUBSTITUTE(A1,", at",""))
To format as DD/MM/YYYY just go to custom formatting and set it to look like the following:
=DATEVALUE(JOIN("/", LEFT(D5,2), {MID(D5,4,2), RIGHT(D5,4)}))
where D5 contains for example: 25.06.2019
which script converts to datevalue: 43641
Dateformat is as dd.MM.YYYY converted to dd/MM/YYYY and then converted to datevalue.
Google sheet's documentation helps:
DATEVALUE, JOIN, LEFT, MID, RIGHT
Datevalue is useful for organizing rows of data by date correctly.
Another solution is to create custom function.
Open tools → script editor in menu to open script editor in new tab
Click Untitled project in top left corner and rename
Open Resources → Libraries in top menu
Paste library key MHMchiX6c1bwSqGM1PZiW_PxhMjh3Sh48 and click Add to add the Moment library to your script
Choose Moment version 9 and click Save
Paste function
function parseDate(dateString, format){
return Moment.moment(dateString, format).toDate()
}
to Code.gs and save project Ctrl+S
Now you use your function in any cell in your sheet:
=parseDate(B2,"MMM D, YYYY, at HH:mm A")
more details about format:
https://momentjs.com/docs/#/parsing/string-formats/
You can also create function to display date in custom format:
function formatDate(date, format){
return Moment.moment(date).format(format)
}
Use it like this in cell
=formatDate(B5,"DD/MM/YYYY")
or
=formatDate(parseDate(B2,"MMM D, YYYY, at HH:mm A"),"DD/MM/YYYY")
I have loaded an xlsx file where the original author used Microsoft Office to create the file. In the spreadsheet, there is a column of dates given in format like "DD/MM/YYYY TT:MM:SS", but they are stored as text. Furhteron, "DD/MM/YYYY TT:MM:SS" is not locale default. I cannot find a way to make LibreOffice interpret it as date. Can someone please help me to reach my aim?
Highlight the column of dates. From the menu, select Data -> Text to columns. In the dialog window that pops up, press "OK". That should do it.
I have a field year which is string type coming from db side.So I converted that to number and adding 1 more year to that to show like this:
Year:2014-2015
Below is the formula.
'Year' & ':' & tonumber({FocusOnCustomer.YEAR})&'-'&(tonumber({FocusOnCustomer.YEAR})+1)
Everything is working fine in designer.But when I view the report in cr viewer I am getting data like this.
2,014.00-2,015.00
I want to remove decimals and comas
Try:
ToText( ToNumber({FocusOnCustomer.YEAR}), "#")
Right-click on the field or formula
Select Format Field
On the Number tab, choose the format to use from the list or click Customize to create a custom format.
Click OK
Website Link
I have a Text Object on my report which is contains some text. What I'd like to do is add a date to the text object that will alaways show the current date. I've tried using a date field, but it is near impossible to line it up correctly.
Any ideas on how to do this? I've been told that there is a way to do this using something like &[], but I can't figure out how.
Thanks!
You can edit the date inline, double click on the text field then select the date text, you can now click on the formatting button on the toolbar and setup the date format.
You can drag any field, including special ones (Print Date for example) into text object - it will line up without problems.