i am working c# windows form application and also in crystal report.i am retriving the date from database in datetime format but i like display date only in report,Is any formula field in crystal report help for me for this problem.Thanks in Advance.
A:
There are many ways you can do this. You can just use what is described here or you can do myDate.ToString("dd-MMM-yyyy");
There are plenty of help for this topic in the MSDN documentation.
You could also write you own DateExtension class which will allow you to go something like myDate.ToMyDateFormat();
public static class DateTimeExtensions
{
public static DateTime ToMyDateFormat(this DateTime d)
{
return d.ToString("dd-MMM-yyyy");
}
}
Ryk
2010-07-16 06:42:29
+1
A:
In selection formula try this
Date(Year({datetimefield}), Month({datetimefield}), Day({datetimefield}))
Johnny
2010-07-16 06:44:27
A:
In crystal report formulafield date function aavailable there pass your date-time format in that You Will get the Date only here Example: Date({MyTable.dte_QDate})
ratty
2010-07-16 07:20:29
A:
If the datetime is in field (not a formula) then you can format it:
- Right click on the field -> Format Editor
- Date and Time tab
- Select date/time formatting you desire (or click customize)
If the datetime is in a formula:
ToText({MyDate}, "dd-MMM-yyyy")
//Displays 31-Jan-2010
or
ToText({MyDate}, "dd-MM-yyyy")
//Displays 31-01-2010
or
ToText({MyDate}, "dd-MM-yy")
//Displays 31-01-10
etc...
Nathan Koop
2010-07-18 13:52:51