I have a problem displaying dates in rdlc reports using C#, the date came from sql server is DateTime type i.e 2013-06-25 02:30:00.000, but when displayed on report it formats according to local PC regional settings. I can't use CDate() to format it the way I want because it returns error, I tried to set Format property of the textBox to dd/MM/yyyy but nothing happened. It seems, it dealt with the date value as string.
How can I bypass the regional settings and let report viewer to deal with it as date not string?
I don't think your problem has anything to do with your regional settings, it sounds like the report doesn't understand that the date field is actually a date.
Make sure that the date field in the dataset is of type System.DateTime
Related
I am trying in D365 to create a dynamic date format, that is based on the preferences of the user. There is a field "Date, time, and number format" and based on the value of this field, the date format has to be changed. The field on the SSRS report is for some other purposes string, created by some values and one date field, so I would like to ask, if there is any function, that would in a code change the date format based on the user's preferences.
Many thanks for any advice
I am trying to convert a field that contains strings such as 202008, 202108 to a date field. I have tried the date() function, clicking on the measure and converting it to a date. I have also tried DATE(LEFT([Month],4)+"-"+RIGHT([Month],2)+"-01") but that will only return the year.
Using Tableau Desktop 2021.1, when I change the data type from String to Date, Tableau translates the strings to 8/1/2020 and 8/1/2021. If you are using an earlier version of Desktop, it is possible that this functionality is not present.
However, if changing the data type isn't working for you, the calculated field code you provided should actually work, you just need to change the date part from Year to Month/Day/Year using the Custom date part option.
I am pulling in date information via MySQL and the date is in the string format of "MM/dd/YY hh:mm:ss"
Using the built in conversion to date isnt working; so I tried using DATEPARSE and also using DATE and manually parsing it. I have had no luck and I have no idea why I keep getting "null" as the answer or it is putting the month as year, day as month, and year as day.
See screenshots below for the different formulas I have used:
DATEPARSE
Original date format
DATE with manual parsing
This worked for me using your example original data
DATEPARSE('mm/dd/yy hh:mm:ss',[Time] )
I used tableau's documentation of custom date formats to find the right formula for the format.
If this doesn't solve the problem then it is most likely due to a Locale issue. The Dateparse function relies on the locale specified by your computer settings to interpret and then display the strings you want to convert and can affect whether a certain format can be specified. This means that if a certain format is not recognised it will return a null. This will often occur is the windows region and language format is changed to another language other than the original language the workbook was created it.
So check your locale and if required execute the following workaround (documented by tableau here):
Open Windows control panel > region and language > format
Click format dropdown and change to original language of workbook creation
click ok or apply and reopen tableau work book
So I'm using a windows script to use Visual Cut to run a report. That report takes in two date parameters (along with additional params). The script was working when I first tested it, but when I went to demonstrate it to a co-worker it stopped. It turns out that Crystal/Visual Cut needed the date parameter in a different format (initially dd/mm/yyyy worked, but now it requires yyyy/mm/dd). How does Crystal decide what format it needs, and how can I make sure my input adapts to that format?
EDIT: Current workaround is to require 'yyyy/mm/dd' format, and I changed the type on the parameters in the report from dates to strings, and then I explicitly call cdate on the values. I just want to know
a) Where the datemask used for date parameters comes from and
b) If passing 'yyyy/mm/dd' to cdate will ever fail (assuming a valid date).
Passing string values and converting them to date, time , number etc might be a problem because you have no control over the user settings. Check what is the difference between the default date format on both computers.
I currently have a reporting services report created in BIDS 2005 and the database is SQL Server 2008 R2. My first issue is when I'm in BIDS and go to preview to test the report it only processes with the date in us format mm/dd/yyyy however if I deploy the report to the report server and run it from there it is fine.
I have changed the report properties to language English(United Kingdom), is there anything else I can do to get my reports to preview in English date format dd/mm/yyyy when in BIDS/VS?
My second and final issue with this is that when I try to create a schedule for this report it also errors as I pass in 2 date parameters (datetime) in the standard SQL format of yyyy-mm-dd using the data driven option. This also runs only if these dates are in US format, any ideas/tips?
Cheers
Ok after a while I have finally found a solution to my data driven subscription (DDS) date issue. Apparently for DDS the settings within the server is used rather than the report settings so I checked the database settings by using SQL Server Management Studio and right clicking the database then selecting properties, I then checked the language settings and hey presto its set to English(United States) how I got around this was to convert my date into a format that was non language dependant -
SELECT convert(varchar, getdate(), 121) – yyyy-mm-dd hh:mm:ss.mmm
This worked and fixed my DDS :)