I have a date time field and want to split the date and time as separate parameter's. I've been able to set the date parameter but not the time, does any one know how this can be done or to include time in the datetime parameter too?
Related
Is it possible to get the datetime when only there are any data changes in the table/matrix?
I don't want to always get the current datetime. I want the datetime to be refreshed only when there is a change to the data in the table/matrix.
This is only possible of you are storing a timestamp in the rows of data that are being queried. If you are storing that timestamp, then simply query it and render it outside of the tablix - you could use a Max() aggregate function to find it from the rows of data.
My MySQL's timezone is UTC. I have many columns with type timestamp. All values in it are stored in UTC. I want to retrieve only one column's date in IST format. I do not want to modify the current dates in the column. Is there any way by which I can change the timezone while retrieving from this particular column?
I want to avoid doing CONVERT_TZ() every time when I am fetching the column. Instead, I am looking for something that will apply this function to a column by default so I do not need to do it every time.
You need to change the query to :
$mysqli->query("set time_zone = '+05:30'");
I have a report that returns basic rows of data. I need to filter this and only get data for yesterday. I was looking into adding a filter to the tablix, choosing the date field, setting operator value to =, and then using Today(), but cannot seem to manipulate Today() using -1 or anything similar.
Any other expression suggestion would be welcome.
Also, for the same dataset, I need to filter for yesterday based on one date filed as long as another date field is not the same date. example, amended date is yesterday, but created date is not the same.
There are a couple of ways of achieving this. You can do it via the filter using two filters, first > dateadd("d",-1,Today()) and second < Today(). But I would recommend using parameters in your SQL rather than doing it at the report stage. In your SQLs WHERE clause you can add
WHERE ...
And
[date field] BETWEEN #StartDate and #EndDate
Then you can create two Date/Time type parameters in your report #StartDate and #EndDate and use those to manipulate the data as needed. Then you can set the default for those parameters to be whatever you want and when running the report it will give you (or your end user) a calendar to pick whichever date range you/they like. Again if you wanted only "yesterdays" data you could set your default #StartDate to =dateadd("d",-1,Today()) and your #EndDate default to =Today() That way your extraneous data will be excised at the SQL level meaning you don't waste resources importing more data than you require and you don't have to mess about with changing the filters if you want a one off run of the report for a different date range.
I am hoping that someone can help me a SSRS Subscription/Report Query. I have a report that takes 2 date parameters as default startdate = 1st Date of the Current Month, enddate = today's date e.g. startdate = 01/05/2017 enddate = 17/05/2017.
Though these are default dates when the report is run you can also after the initial run change these dates to anything else that you want.
What I want to do is set up a subscription service that runs on 1st of the month and sends the report to a folder on the network.
What I want to do though is replace the startdate and enddate at the point the subscription is run with the startdate and enddate of last month e.g. on the 1st of May the startdate = 01/04/2017 and enddate = 30/04/2017.
What I thought I would do is create a stored procedure in my report with the relevant dates on it for all scenarios that I will need. Set the Last Month one's with default values from the procedure.
Now I can see all date parameters that I might need within the subscription set up but I cant see how I can change the default run time ones when the report is just run on a daily basis by a user to the ones I need it to run for the last month. I know I could just create another report to do this but it seems silly to have multiple reports with only the dates differing and I going forward I am likely to use this logic on other date ranges.
The initial code and idea came from this link "SQL Server: calculating date ranges"
Thanks
Hi R.Richards, since posting the initial query I have been testing a few things with Data Drive Subscription and I think that one of the issues may be due to date format. My report parameters are just set up as date/time but as stated I am wanting to use a function/procedure to call the relevant date splits. The code I am using is in the link that I posted to the original query but I can post it here as well if it helps. When using data driven, if I just use the date default in the report there appears to be no issue but when I select it from the function it errors, the function returns year/month/day timestamp but when I see my defaulted date in the parameter its day/month/year timestamp??
Thanks Phil
In my mysql database table i have two columns called "date" and "time". "date" datatype is set to DATETIME and "time" datatype is set to TIMESTAMP. what i want to do is store only date in "date" column and store only time in "time" column. my table name is "loans".I'm not good in SQL querying. someone please show me exactly how to do that.
And also i have some another problems with time zones. i want to convert my database time format to UTC -5:00 (us time).how can i do that without change my PC time ?
Separating DATE and TIME for same event is a bad idea. I would go for storing it in simple DATETIME field.
But you can do it with this
Give date field type DATE(not DATETIME) and time field type TIME (yes it exists and not TIMESTAMP)
Now this will allow you to store date in YYYY-MM-DD and time in HH:MM:SS
To set the time zone of your MYSQL server you can use this one
How do I set the time zone of MySQL?