In MySql Date column format is "yyyy-MM-dd"
When I try to load it on report I got #Error
I tried using CDate and set Localization - Language but still doesn't work
What I'm using to fix this now is to use date_format from MySql query like this
date_format(myDate,'%d/%m/%Y')
and when I use myDate in SSRS report I have to convert it by using CDate
I'm just curious to know there is anyway better?
Related
How to select format date using carbon ?
I'm used format ->select(DB::raw("(DATE_FORMAT(score_dt, '%M'))")) before.
I want to change the format by using carbon, how do I use it in a select query? to display month name
Have a read of the Carbon docs. Laravel uses Carbon 2 now.
You should be able to get the month name with the monthName property: $yourDateObject->monthName.
Carbon, however, is a PHP library and is not part of the database you're using. This means you can't use it in your select query, to use Carbon, you'll need to format your data in your model/controller/frontend. This is a fairly standard way of turning ISO8601 dates into human readable form.
06/07/2559 < this is dd/MM/yyyy
This is ok for converting but CDate convert to this format MM/dd/yyyy
If I use this
30/06/2559 I'll get error because CDate think 30 is a month.
Anyway to convert my string dd/MM/yyyy to Date in Report?
Thanks in advance
Three ways/things that you can do to achieve this -
You can set the localisation format at the report level which means you don't have to use the format function every time you drop a date on to the report.
You can covert the string to your required format ('mm/dd/yyyy' or 'dd/mm/yyyy') in database itself. For your reference in MSSQL you can do it like this -
You can format (use FORMAT() function) your code in SSRS itself somewhat like below -
On that field change attibute Language to es-Es (or any other country that uses dd/MM/yyyy format)
The following conversion is not working. I would like to see if anyone can be able to solve it.
Syntax:
ToText(Date({db.field}),"dd/MM/yyyy")
System is saying that the date id is required.
however ToText( Date({db.field}), "dd/MM/yyyy") is working fine....
the other simplest way is :
Crystal Report Design Window->Right click on date field->format Field->Customize the date format as you want to.
I want to know the format to get the number of days between two dates in spagoBI studio?
I have StartDate and EndDate and I want to know the Number of days between these dates.
The first question to ask is what type of document are you creating in SpagoBI studio? Is it a BIRT or Jasper Report? It is a chart ? Almost everything coming in from a SpagoBI dataset is treated as a String.
If you were using JavaScript in a BIRT report, you would need to covert those ENDDATE And STARTDATE row values to equivalent JavaScript date objects before performing calculations .
What about modifying the dataset query to perform the date difference in SQL and pass that back as a column?
By default if the input parameter to BIRT report is of type Date, it takes yyyy-MM-dd format.
Can we change to something else e.g. may be dd/MM/yyyy ?
You can change the input format for a date parameter. Click on "Change..." select Format as "Custom" and you can enter a valid format code as you like.
If you want to enter a default Date you still have to use the yyyy-MM-dd Format, this cannot be changed ( where I used new Date() in the Picture), but the output format will still be your entered format.
Another option is to use the format Date Time section in the Birt designer and choose the right locale and formatting for the date.
I have done it in Birt 3.7 and works fine
There can be many way to do that but the easy one is you can do this in SQL Query itself.
If you are using DB2 you may try
VARCHAR_FORMAT("Your Column Mapping Name",'DD-Mon-YYYY') AS dataSetName.
But this will change its Data type to String
Try if this make any seance.