SSRS Date value is not valid - reporting-services

A few weeks ago the guys who handle our servers upgraded from MSSQL2008 R2 to MSSQL2012 ServicePack 2
Now all the reports where we pass a date parameter from our application give us an error.
The date in the database is in the following format: "DD-MM-YYYY 00:00:00:0000"
So we changed the value we are passing from our application to fit this format, but the date is still invalid.
We don't debug on the server, so we installed all relevant versions locally and it worked fine.
Anybody else had this problem?

Yes, I have had that problem with a update from SQL2012 to SQL2014. But that was caused by the fact that SQL 2014 has more datefields. This is not relevant for you.
In your case though, I would change all the fields to this format:
"YYYY-MM-DD 00:00:00:0000". You can reformat it in the report if you want it to be shown like "DD-MM-YYYY 00:00:00:0000"
I suspect it has something to do with regional settings somewehere. When using YYYY-MM-DD instead of DD-MM-YYYY you avoid al that sh*t.
I always use YYYY-MM-DD to avoid confusing.

Related

What format does a Google Data Studio DATE field expect from the connector?

I am building a Google Data Studio connector with a field called date. The field's type is YEAR_MONTH_DAY. Now, when I return a string, for instance "2020-09-22", the field shows null as a result. What value should my connector provide to have Data Studio recognize it as a date?
"2020-09-22" is of type YEAR-MONTH-DAY, not YEAR_MONTH_DAY
Without knowing the specifics of the connector you are using:
Be careful theat your provided format matches the expected one
Read about supported Dates and times in Data Studio
If necessary, use date formatting methods like e.g. TODATE
If the DATE field you are talking about is the absolute date as mentioned here, the expected format is YYYYMMDD.
For some reason I have had to implement a workaround for this more often lately which is to create a new field in the data source and use the TODATE() function and use that new field in my dimensions on the report.
Try a formula field like:
TODATE(comp_pd_end, "%Y-%m-%d", "%Y%m%d")
The expected date format for the connector is YYYYMMDD, without any separator.
You can check the official documentation:
https://developers.google.com/datastudio/connector/reference?hl=en#semantictype

Can't get the Today() function to work properly in MS Access 2016 Custom Web App

I'm trying to setup a query that will show me all of the records in a particular table where the listed expiry date is either in the past or upcoming in the next 6 months (approximately).
At the moment, I have the "Expiry" field added to my query and the 'Criteria' as .
When I try to save the query, I get the following message:
Access can't evaluate an expression or convert data because data types aren't compatible with each other.
TECHNICAL DETAILS
Correlation ID: ae68949d-3041-3000-0984-71635f8fd670
Date and Time: 7/28/2016 6:54:34 PM
I've tried searching the web for a solution, but most websites refer to the Date() function that doesn't seem to be available in the Access 2016 Custom Web App. When I take out the "+180", it works fine but obviously doesn't give me what I need.
Any help would be appreciated.
=============================
UPDATE:
Some users have asked for my SQL and Table Design details. I don't seem to have any way of accessing the SQL View (the option doesn't appear), but here's a copy of my table view:
Access Query Table Design
In the table, 'Active' is a Yes/No field and 'Expiry' is Date/Time.
Try
< DateAdd(Day, 180, Today())
as criteria.
According to https://msdn.microsoft.com/en-us/library/office/jj249452.aspx this should work in a custom web app.
Error says that you have two different date types and they can't be compared. so, as the Today() returns only the Date with 12:00 pm, I can guess that your other "Expiry" Field is a datetime type. So, you can do either: use Format function to convert datetime to date like this
Format([2/22/2012 12:00 PM],"dd/mm/yyyy")
or use Now() function which returns datetime,
or Share your Code :)

SSRS - date-time parameter transposition

This is a problem in DEV with the following configuration:
SSRS 2012
Reports configured to the language en-gb
I have recently noticed that all of my date time parameters are getting transposed when i click "View Report". So for example a GB date 08/01/2015 gets transposed to 01/08/2015 on clicking "View Report". This results in having to click the button twice for the report to show me the correct data. I have used SSRS on and off for many years and I have never noticed this before. Can anyone shed some light on this?
Obviously the parameter is switching between en-gb and en-us but why and how do i stop it?
I found a post where some one is suffering from the same problem as me but their solution seems a little overkill issue with DateTime datatype in SQL Server Reporting Services. They recomend changing your regional settings and IIS settings which may fix and or break all sorts.
I believe that the problem can be how do you set up the default value in the parameter definition. If instead of a fixed date, you use a dataset with a date time funtcion (something like " Select dateadd(month,-1,current_timestamp) as [Default Date]") and a default value based on that dataset, your problem could be solved, because you're not specifying any date format in the dataset's field and it should contain the right value.
Hope this helps.

dd/mm/yyyy date format in SSRS

i'm trying to specify dd/mm/yyyy dateformat for date/time parameter in SSRS 2008 R2.
My computers datetime format is mm-dd-yyyy.
My requirement is, i want to show date format at dd/mm/yyyy irrespective of the system/server date format.
I've already tried CDate(Format(Today,"dd/mm/yyyy")) which didn't work. one very strange thing i observed is, it shows dd/mm/yyyy format only for dates on or before 12-MM-yyyy, and 13 onwards it gives error: Conversion from string '25-04-2014' to type Date is not valid. (Possibly it is trying to map 25(daypart) with MM-dd-yyyy (month part)) which is out of range of total months i.e. 12)
my research on internet says it is a bug in BIDS 2008.
What do i do to display date as dd/mm/yyyy ??
I don't have enough reputation to comment, but I did notice that you failed to put "()" after "Today". If I'm not mistaken you must put Today() for that function to work. Also, you might want to try putting CDate Around the Today() function. You shouldn't need it, but it's worth a shot. Also, for some odd reason, in my experience, you must capitalize MM for format to work correctly.
Like #Aditaya said, it should be =format(Today(),"dd/MM/yyyy")
The expression I usually use is:
=FormatDateTime(Fields!Date.Value, DateFormat.ShortDate)
However, this may be region specific.
Rather than writing an expression to do the formatting, you can also use the Textbox Format Property. But first you need to make sure that the data is in a date format. So use the CDate function on your column like this:
=CDate(Fields!Date.Value)
Then in the textbox properties go to the Number tab. Select Date for the category. Then you can select whichever format you want or use a Custom format. This will change how the column displays when you run the report.

rails change date format before saving to mysql DB

I have a datepicker that I want to display in MM/DD/YYYY. However I'm using a mysql db which wants YYYY-MM-DD. As it stands right now its saving but the day and month are being reversed.
Right now I have an initalizer, date_time_formats.rb which has:
Date::DATE_FORMATS[:default] = '%m/%d/%Y'
Also in my datepicker jscript I have the correct format which I want to display:
$(this).datepicker({"format": "mm/dd/yyyy", "weekStart": 0, "autoclose": true, "startDate":new Date()});
I've tried things like this:
Date.strptime(params[:location], "%d/%m/%Y")
But I get a HashWithIndifferentAccess error.
How can I reformat the date in the params hash prior to assigning to an instance of the model? The reason being it seems to get rejected from the model if the date would be invalid (ex. April 4, 2013 is fine, but April 20, 2013 is not because there is no 20th month). I'm a big time rails novice so maybe I'm wrong but thats how it appears to be working. Thanks!
try the american_date gem located here: https://github.com/jeremyevans/ruby-american_date
Look up the strftime method of the various date classes. The incantation you want is Time.local(params[:location]).strftime('%m/%d/%Y'), hope that helps!
A quick way to sanitize the date to the correct format is to grab it in the controller before it gets saved and use strftime to correct the format. For example:
#model = Model.new(model_params)
#model.date_you_want = #model.date_you_want.strftime('%Y/%d/%m')
#model.save
This saves the date in the correct format. (I'm also using datepicker-boostrap gem)