0

Hi,
I let say I use this code to retrieve date from database

SELECT Table.Date FROM Table

The format is 01/09/2013 (dd/mm/yyyy)

How will i format this to get 09-Jan-2013 output then print this format to crystal report?
I'm using dataset to connect data to crytal report
I just noticed if im not mistaken that even I format the date to different format, the date in crystal report is not changing.

Thanks in advance

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by Lethugs
0

Incase anyone needs it here is how the above can be done:

string.Format("{0:dd/MMMM/YYYY}", Convert.ToDateTime(reader["Date"]).ToLongDateString());
0

I dont know if this works or some kind of ms code but i did it bby converting the nvarchar to date then convert it again to varchar before making some formatting. i dont know why but formatting for me doesn't work with nvarchar datatypes.

0

Sorry I must have missread your first post. My reply above is a solution if you want to convert a dat formatted as "dd/mm/yyyy 00:00:00" this has been loaded from an SQL database, to dd/mm/yyyy format in C#.

Could you post your solution so I can have a look at how you did it please? Also it would help other people with the same issue.

0

Sorry for the late rep, here's what did

CONVERT(varchar(MAX), CAST([Table].[Date1] AS Date), 107) AS Date

Hope it helps

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.