Wednesday, March 7, 2012
Date format display problem.... :(
I'm having problem with the date format while displaying report. I'm using Crystal Report 8.0 and have a report with field EFFECTIVE_DATE. I'm using a ttx file to display data in the report where this field has been declared as Date. I have set the format for this field as MM,DD,YYYY but, when the report displays in the application in which I'm using it, the field shows as YY,MM,DD. Can anybody suggest me what shall I do to get it back to MM,DD,YYYY. I'm using C# and .NET 2003 IDE for my application.Right-click on the field on the report and select 'Format Field' option.On the 'Date-time' tab, set the format you need.
From the menu, select File->Options->Fields. Click 'Date' button and set the Order option to MDY.
Hope this helps.
Rashmi
Date Format
I have a written a stored procedure and excecuting it and displaying it in gridview(ASP.NET). I am getting Birthdate in the form of8/23/1956 12:00:00 AM. I just need8/23/1956. I have defined it as smalldatetime in stored procedure. How can I get it in that format ?
HELP.......
In your .net code, if the object is of type DateTime you can call ToShortDate.
|||Either you can convert the datetime to a varchar in your stored procedure:
select convert(varchar(10), getdate(), 103)
... or you can format the output in the GridView:
<asp:BoundFieldDataField="now"DataFormatString="{0:dd/MM/yyyy}"HtmlEncode="false"/>
|||Set the DataFormatString, either in designer or HTML:
<asp:BoundField DataField="Date" DataFormatString="{0:dd-MMM-yy}" HeaderText="Date" HtmlEncode="false" />|||You can read more about CONVERT here:http://msdn2.microsoft.com/en-us/library/aa226054(SQL.80).aspx
...and more about DataFormatString here:http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx
|||Thanks a bunch ... millepag
That CONVERT thing worked for me!!!!