473,804 Members | 3,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crystal Reports Date/Time Issue

2 New Member
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to select time also. But i don't want to choose time, I only need the date component. Is there any way i can supress/remove the time field in crystal.
Sep 6 '07 #1
5 11945
Jim Doherty
897 Recognized Expert Contributor
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to select time also. But i don't want to choose time, I only need the date component. Is there any way i can supress/remove the time field in crystal.
Can you not in a position to cast or convert your date to varchar as part of the select or where clause?

CONVERT(varchar (10),@YourDateP arameter,103)

Regards
Jim
Sep 7 '07 #2
rammy
2 New Member
Jim,

I thought about that idea, but crystal will not show the calender when i use varchar as input parameter. The user may have to type the date in the text box and there will be no validation for the date. The calender gives user ablity to select the date they wanted. Is there any other way to hide the time component?

Thanks,
Rammy
Sep 7 '07 #3
Jim Doherty
897 Recognized Expert Contributor
Jim,

I thought about that idea, but crystal will not show the calender when i use varchar as input parameter. The user may have to type the date in the text box and there will be no validation for the date. The calender gives user ablity to select the date they wanted. Is there any other way to hide the time component?

Thanks,
Rammy

Rammy

SQL Server is going to return a date and time together as is its datatype

try this conversion to see how it effects you select cast(convert(va rchar, getdate(),101) as datetime) you can amend the 101 to 102 or 103 or whatever your localisation needs demand

I take your point about the Crystal calendar but if you look at the item thread 5896

at this link

[HTML]http://technicalsuppor t.businessobjec ts.com/cs/forums/thread/5678.aspx[/HTML]

In addition to that look at this link thread discussion both of which seem to conclude that overall it seems there is no real issue with CR accepting a conversion as I outlined earlier and above

[HTML]http://forums.database journal.com/showthread.php? t=35083[/HTML]


Regards

Jim
Sep 7 '07 #4
harrywhelks
2 New Member
I agree. The date calendar prompt thinggummyjig is a damned nuisance. And the convert function supplied by a previous post puts the date in mm/dd/yyyy which is US not UK version.
select convert(varchar , getdate(),101)
06/17/2010


I'm sure there is another format code to get it in the UK version but personally I normally select the date in my stored procedure using one of these user-friendly formats listed below to retrieve the date in varchar (i.e. SQL Server equivalent of string )format and then simply get the CR user to type in the date in that format e.g. 2008-08-17 also, make the CR parameter a string also and then you're comparing like with like.

Too bad you can't use the funky date picker calendar - you probably can if you set the input parameter to Date and play around with CR formulas for a bit.

User Friendly Format 1
=============== ======
Select TOP 15 CAST(DATEPART(y yyy, M.mopendt) as varchar(4))+ '-'
+ RIGHT ('00' + CAST(DATEPART(m m, M.mopendt) as varchar(2)),2) + '-'
+ RIGHT ('00' + CAST(DATEPART(d d, M.mopendt) as varchar(2)),2)
from matter M
1981-12-17
1985-08-21
1998-05-26
1981-09-21


User Friendly Format 2
=============== ========
Select TOP 15
RIGHT ('00' + CAST(DATEPART(d d, M.mopendt) as varchar(2)),2) + '/'
+ RIGHT ('00' + CAST(DATEPART(m m, M.mopendt) as varchar(2)),2) + '/'
+ CAST(DATEPART(y yyy, M.mopendt) as varchar(4))
from matter M
17/12/1981
21/08/1985
26/05/1998
21/09/1981


User Friendly Format 3 (for display on the CR report)
=============== =========
select top 15
CASE
WHEN datepart(dd,M.m opendt) IN (1, 21, 31) then RIGHT('0' + CAST(datepart(d d,M.mopendt) as varchar(2)),2) + 'st ' + DATENAME(month, M.mopendt)+ ' ' + CAST(datepart(y yyy,M.mopendt) as varchar(4))
WHEN datepart(dd,M.m opendt) IN (2, 22) then RIGHT('0' + CAST(datepart(d d,M.mopendt) as varchar(2)),2) + 'nd ' + DATENAME(month, M.mopendt)+ ' ' + CAST(datepart(y yyy,M.mopendt) as varchar(4))
WHEN datepart(dd,M.m opendt) IN (3, 23) then RIGHT('0' + CAST(datepart(d d,M.mopendt) as varchar(2)),2) + 'rd ' + DATENAME(month, M.mopendt)+ ' ' + CAST(datepart(y yyy,M.mopendt) as varchar(4))
ELSE RIGHT('0' + CAST(datepart(d d,M.mopendt) as varchar(2)),2) + 'th ' + DATENAME(month, M.mopendt)+ ' ' + CAST(datepart(y yyy,M.mopendt) as varchar(4))
END
as friendly_mopend t_ver1 from Matter M
--sample
17th December 1981
21st August 1985
26th May 1998
21st September 1981
Jun 17 '10 #5
harrywhelks
2 New Member
Hi,

As an update to the last post, here is how it is done.
No need for user friendly columns although these can be very useful for displaying on the report itself.

You bring in the column from the database (fopen DateTime) and you create a parameter of type Date called DatePicker. Then you click on the filter shaped icon to open the Select Expert and add the below line as a condition.
CDATE({vwLabels DailyNewFolders .fopen}) = {?DatePicker}

CDATE converts DateTime to Date so you are now comparing like to like and can use the Calendar prompt datepicker supplied by Crystal.


Thanks, Seán
Jun 17 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
19189
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
14
2210
by: LP | last post by:
Hi, I will be taking on a new project developing a web-based "reporting system". The first requirement I got from BI group is "we just want to look at the data". Basically, there is a huge database, and they want certain people to be able to drill down to the data they want, perhaps a few graphs here and there, and then extract selected data to an Excel file or a flat file for further analysis. As of now there are a handful of parameters...
19
3883
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set ReuseParameterValuesOnRefresh="True" in a viewer, but it still doesn't work. Did anyone run into this problem. What's the solution? Please help. Thank you
1
2202
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am brand new to using Crystal Reports and am trying to generate a report based on a custom object - in another project. I have a layered design, with all my business objects in a seperate project. I created a new project as part of the solution, added a reference to the project containing my business objects, created a datasource that points to one of the objects and then tried to create CR based on the object. The data tab (in the CR...
11
9701
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.