Datetime Format Setting In SSRS - reportingservices-2005

We have a requirement where date time values would be passed to the report parameter which is of "String" date type (and not "DateTime"). The report parameter would be a queried one i.e. it would have a list of values in which the passed value should fall in.
The strange part is that if the date time value passed to this parameter is passed in this format mm/dd/yyyy hh:mm:ss AM/PM then only it succeeds otherwise a error is displayed (If month/date/hour/minute/second is having a single digit value then we need to pass single digit value to parameter as well).
Assuming that the report server picks this format from the "regional settings" in control panel, we tried modifying the date & time formats as yyyy-mm-dd & HH:mm:ss but the outcome was the same.
On researching more I found some suggestions specifying to change the language property in the rdl (I was not able to figure out how) but this would not be the solution I am looking for. I also found another topic here but it didn't provide the solution we are looking for.
I need to understand if this format is controlled at the report server level & is it configurable. It would be great if someone can provide some guidance.
Thanks.

Format(,"mm/dd/yyyy hh:mm:ss AM/PM ")
Then it doesn't matter what the regional settings are.

Related

Changing format of date without using to_char - Oracle

I have to get the max payment date on an invoice and I am having trouble with the date format. I do not need the max in this formula as I am using the format in a reporting tool that is pulling the max from what it finds for me.
Using "to_char({datefield},'mm/dd/yyyy')" works for displaying that date the way we would like BUT when you use summary function MAX it does not pull the correct date because it is looking at a string and not a date (it will think 12/3/21 is larger than 3/2/22).
Another thing I have tried is trunc - "trunc({datefield})" which gives us the correct max date but it changes the formatting. For example if the date prior to the formula being applied is "8/12/21 12:00:00:000" the trunc formula will display it as 12-08-21 which is horribly wrong.
Long story short is I need a way to change a date/time to date with the format of 'mmmm/dd/yyyy' WITHOUT converting it to a string with something like to_char. Thank you!!!!
A DATE is a binary data type consisting of 7 bytes representing: century, year-of-century, month, day, hour, minute and second. It ALWAYS has all of those components and it is NEVER stored with any (human-readable) format.
What you are seeing when a date is displayed is the client application you are using to access the database making a decision to be helpful to you, the user, and display the binary DATE provided by the database in a human-readable format.
If you want to change how the DATE is displayed then you either need to:
Change the settings on the client application that controls how it formats dates when it displays them to you; or
Change the data-type so that it is no longer a DATE (which does not have a format) to a data type where the values of the date can be formatted (such as a string). You can do this using TO_CHAR.
If you want to find the maximum then do it BEFORE applying the formatting:
SELECT TO_CHAR(MAX({datefield}),'mm/dd/yyyy')
FROM your_table;

SSRS Cache Report Parameters Previous Week

Is there a way to set the Parameter Values in the Cache Refresh Plan window to use the previous Sunday? The field is a Date/Time field and will not let me enter code such as =DateAdd(DateInterval.Day, -7,DateAdd(DateInterval.Day, 1-Weekday(today),Today)). It is looking for date format. Thanks in advance
I'm unaware of any parameter caching options. However, you should be able to get a default value to work. Perhaps the expression below will work.
=DateAdd(dd,1- DatePart(dw, CDate(Today())), CDate(Today()))
If you still can't get it to work, another option would be to add a data set that spits out the value. You could use something like:
SELECT DATEADD(dd,1- DATEPART(dw, CAST(GETDATE() AS DATE)), CAST(GETDATE() AS DATE))

400 - Bad Request while saving Date Only field in CRM using Web API

I am using Microsoft Dynamics 365 Web API approach to interacting with CRM data.
Here I want to update the field with type: DATE and TIME.
Date value I am passing in the request body is as below:
"packfirstday":"1-15-2018"
Except for above, I have also tried with DateTime and with different date formats.
e.g.
mm-dd-yyyy
m-dd-yyyy
mm/dd/yyyy
yyyy/mm/dd
yyyy-mm-dd
PS: I try to post without date field it is saving details successfully.
The problem is not with the code, the simple misunderstanding.
There are 2 components namely Behavior & Format. You have Format set as 'Date only' not the Behavior. Behavior decides the Database terms whereas Format is used for displaying datepicker controls in Form.
So when you set the field in web api with only date part - the CRM database expects time part also.
Either set behavior also as date only, so this will work:
"packfirstday":"2018-01-15" //YYYY-mm-dd format
Or change your code to pass time part also:
"packfirstday":"2018-01-15T11:10:00.000Z" //UTC offset
Since user local behavior still expects the time part.

Compare two string fields with format HH:MM AM/PM in Lotusscript

I have a dilemma. I'm trying to compare two TEXT fields, TimeDate having HH:MM AM/PM format, and TempTimeDate having HH:MM AM/PM format.
May I ask how do I compare them in Lotusscript?
Yes but, what exactly do you mean by "compare" ? Since testing equality would be trivial, I'll assume you want to know if one date is earlier than the other.
In LotusScript, the way to go is to instanciate NotesDateTime objects,
then use their TimeDifference method.
Now, it would maybe be a good time to ask why are dates stored in plain text fields. One option could be to simply change their type to DateTime in the form, then run a simple agent base on #TextToTime. That way, from now on and forever, getItemValue would directly return a DateTime object. You'd also gain a finer control of format in documents and views and leave a generally cleaner, more consistent and more maintenable design.

How to format birt date report parameter?

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.

Resources