Reporting Services: DateTime parameter not showing the time part when its midnight - datetime

I need to add a 'StartDate' parameter to a report in Reporting Services 2005, which should represent the current date, at midnight.
If I use Now() as expression, it will correctly use midnight in the calculations, but to the user, the time part will not be shown.
13/12/2011
which can be confusing because then the user doesn't really realise he or she can type in a time part.
How can I format this date to the following:
13/12/2011 00:00
while keeping the parameter as a DateTime datatype.?
Edit: I've checked the duplicate question and tried to apply it to my case, but run into the following phenomenom:
If I try:
=DateTime.Parse(Format(Now().Date().AddSeconds(1), "dd/MM/yyyy HH:mm:ss"))
Then the parameter shows "14/12/2011 00:00:01" which is confusing for the users, so I then tried the following:
=DateTime.Parse(Format(Now().Date().AddSeconds(1), "d/M/yyyy HH:mm"))
But then the parameter shows "14/12/2011" again! In other words, the time part is gone again!
Who invented this stuff? :P

Your formula with .Parse(Format(... causes redundant work that is messing things up. Try this:
=Now().Date().AddSeconds(.001)

Use Format. For example: Format(Parameters!SelectedDate.Value, "d/M/yyyy HH:mm")
Here is a list of DateTime identifiers for use with Format.
Edit:
I get it now, you want 00:00 to show up in the parameter input calendar in the report viewer. The time part won't show up when it's set to midnight. This is by design. If you're using 2005 or earlier, Jamie's solution won't work and you're stuck.

Related

Get Short Date Format/Style/Structure

Suppose my system date is 2014-02-10 & I have published my app on Internet Information System. Now Using DateTime.Now.ToShortDateString method I can get date like 2014-02-10, but how can get pattern/style/structure (e.g yyyy-MM-dd) for date? It should be irrespective of current culture.
IF I change date to 10-Feb-2014, then I should get dd-MMM-yyyy.
What's the solution? Thanks in adv..
Ah, I see. I thought you were saying that you wanted to format a date value but it seems that you're saying that you actually want the format string. In that case, you need to use get an appropriate DateTimeFormatInfo object and get its ShortDatePattern property. You can use System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat or System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat to get that DateTimeFormatInfo.

SOLR Date range

I have to make an ezfind search page with date functions. For the SOLR filter I tried to use something like this: attr_publish_date_dt:[NOW-6MONTH TO NOW] but I don't get any result.
If I use it this way attr_publish_date_dt:[* TO NOW], it works. But all queries without an asterisk on the left hand don't work.
attr_publish_date_dt contains a unix timestamp so I also tried to use 2 timestamps from the attr_publish_date_dt:[* TO NOW] result, instead of [NOW-6MONTH TO NOW], but then I get also no results.
Can anyone help me please? Thanks in advance
Frank
Date searches are supported on a date field. You will need to define a field of that type, and submit dates in ISO-8601 format.
http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
If you cannot properly format the timestamp before sending it to Solr, you may be able to use a DateFormatTransformer or a ScriptTransformer to do the job.
http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer
http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer

create date formatted custom_meta field in wordpress admin

I have created a custom meta field to be used within a custom post type, that is to be the start time of a series of events. However, I would like to run my query_posts off of this value, but it is not formatted in date/time format, therefore '1:00pm' shows up in the list before '9:00am'. Is it possible to format this value in the db or at least prior to setting the 'meta_key' meta_value in my arguments for my query?
I've come across this problem a few times before. I'm going to use my most recent example because it sounds like it's along the same lines of what you're doing.
I had to create an event calendar using WordPress. In my custom post type, I had two fields: a start time and an end time. Instead of just using "1:00pm" as the start and end times, I also included the dates. This would allow for events that would last an entire weekend like a concert or a race.
What I'm getting at here, is once the user submitted that the event started on January 3, 2012 at 8:00 am and ended on January 3, 2012 at 10:00 am, I saved both of the variables using strtotime(). If you're not familiar with this function, you can read more about it here: http://us.php.net/manual/en/function.strtotime.php.
I also suggest using the datetime picker add-on for jQuery UI http://trentrichardson.com/examples/timepicker/.
I hope this helped. I know I was a little vague at times. If you need me to explain anything in more detail, don't be afraid to ask.

Date formats in ActiveRecord / Rails 3

In my model, I have a departure_date and a return_date.
I am using a text_field instead of the date_select so that I can use the JQuery datepicker.
My app is based in the US for now but I do hope to get international members.
So basically this is what is happening. The user (US) types in a date such as 04/01/2010 (April 1st).
Of course, MySQL stores it as a datetime such as 2010-04-01...
Anyway, when the user goes to edit the date later on, it shows "01/04/2010" because I am using a strftime("%m/%d/%Y) which doesn't make sense....so it thinks it is January 4th instead of the original April 1st.
It's like the only way to accurately store the data is for the user to type in: 2010-04-01
I hope all of this makes sense. What I am really after is a way for the user to type in (or use the datepicker) a date in their native format.
So someone in Europe could type in 01/04/2010 for April 1st but someone in the US would type in 04/01/2010.
Is there an easy, elegant solution to this?
Thanks for any suggestions.
I have been confronted to the same issue lately.
My website is based in france, so i have to store date as a french date.
I also use a Jquery DatePicker.
To do this, i set the I18n.locale to the visitor's country. For exemple :
I18.locale = :fr
You can do this with a before_filter into your application_controller
Then, into your locales/fr.yml you can define the way you want to show the date
And finally, into your view, you can set the date format view, with the JqueryDatePicket properties.
If i remember well, this methode was something like that:
$.datepicker.formatDate('dd-mm-yyyy');
You can find it anyway on the datepicker documentation.
And this format can be found for exemple into your locale/fr.yml
And that's all !
Hope this will help !

Setting report to current date

I have a report where it shows meetings and their requirements. However i just want the report to show ONLY today's stuff--not the entire week's worth.
I tried setting my group header (i'm grouping by day) to currentdate but yet it still shows me the entire week. I then have to go to the grouping tree and select today's date. Is there any way to run my report and have it ONLY show today's stuff and nothing else???
Any ideas?
Use the select expert to limit the results to today's date. printdate is a special Crystal Formula keyword.
{table.date_field} = printdate
Or, if you're working with a datetime db field you can strip the time with CDate
CDate({table.date_field}) = printdate
One way would be to change your query so that it's only getting one day's worth of data; that is, assuming your data contains a date field. To take it a step further, you could add date parameters to the query itself and leave the group headers as is. That way, you can have one day of data, or data from a specific date range.
If you have no influence (or desire) to change the way data comes into Crystal Reports, you could also add a formula via the Section Expert to suppress the group or detail section unless the date is the current date.

Resources