I am using the StimulsoftJS designer and adding a Group header. The grouping condition is based on a date which comes from my json object as a string. How can format it into a date so I can use WeekOFYear? Since the date is in a string format in the json and I dont see a tryParseToDate function, what is the best way to do this?
So, the answer to this is to edit the data source in the designer and select the datatype as DATETIME.
Related
I have a column in my database that is of type DATE.
I inserted the date via Java using the method: Date.valueOF(LocalDate.now()).
r.setRkd(Date.valueOf(LocalDate.now()));
The entry is correct because the exact date appears in the table.
rkd
------------
2022-03-02
The problem is that when I call the service I don't get the correct date back in the JSON, but a series of numbersenter code here.
"rkd": 1646175600000
Do you know how I can print the correct date in my JSON?
Thank you in advance.
That number you are getting is the milliseconds equivalent to the date you have stored. As far as I know, dates, in general, are stored as milliseconds and displayed in different formats, e.g. YYYY-MM-DD
If you need to display it in date format there should be a method to do it depending on the specific language that you're using.
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
I have a column in the database that looks like this:
2015-10-22 11:26:19.3157376
SSRS automatically converts it to this:
10/22/2015 11:26:29 AM
I want the report just to show how it is entered in the database without formatting it. I know I can get this by doing:
=Format(Fields!creationdt.Value, "yyyy-MM-dd hh:mm:ss.fffffff")
Is there any way to just output the raw text from the DB without using format function?
I appreciate any help on this.
Well, it's interesting to say that the field in the database "looks like this", if it is a datetime datatype, because the text you see in the results of a query is just one representation of the actual stored data. The datetime datatype is stored in a special way that you'd never see just by querying. That data then gets represented as text in a variety of ways.
One thing you can do is to cast the datetime to a string data type in your query, which will make it display exactly in SSRS. However, you run into much the same issue on the sql side of things - the convert function to take the datetime value and put it into a string value allows the user to specify what format to display the date in, which is essentially the same thing you're doing with the Format function in SSRS.
I have a date column in my table, which will display a date as '17-MAR-15' format. Now I need to pass the date as 'DD-MM-YYYY(17-03-2015)' format to the Java API call. How can I pass this date parameter in that format?
You should take a look at: DATE_FORMAT
But basically what you do is this:
SELECT DATE_FORMAT(dateColumn, '%d-%m-%Y') FROM xyz;
Edit: Well, should have waited until I was really awake to answer, but if you happen to convert your date column to the date type this is how you would get the date in the specified format.
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.