Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-20 : 07:55:04
|
Hi All,Can anyone advise me if I can enter an expression into the format property of a field, so the date is displayed as dd/mm/yyyy ?It is currently mm/dd/yyyy hh:mm:ssI have been trying with convert and FormatDateTime, but can't seem to get this to work in the Report layout editor. I would like to know how to do it here, rather than changing my query.Thanks in advanceHumate |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-12-20 : 08:34:19
|
just right click on the field on the report, select "Properties", click on the "Format" tab, and click the little dots next to Format Code. Pick what you want or make up your own.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-20 : 08:45:08
|
Thanks Jeff. My problem is that in the drop down list there is no format like dd/mm/yyyy.I have tried to create a custom one can't work out the correct expression. Have you any ideas how I do this?Thanks |
 |
|
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-20 : 08:50:33
|
This is what I have tried by the way - I entered ddmmyyyy and for a date it acts like this:Original---------------------Modified12132007 12:00--------------13262007 |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-12-20 : 09:36:47
|
First off -- be sure that your report field is bound to an actual dateTime data type, not a varchar or an int or something like that.If it is really is a dateTime, and you want to see a dd/mm/yyyy format, then you use: dd/MM/yyyy as the format expression. (MM = month, lowercase "m" = minute ...)more here on custom datetime formatting in .NET:http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-20 : 10:32:36
|
Jeff, that is exactly what I was after. Seems like my expression was looking at minutes, rather than months.Thanks, happy holidays! |
 |
|
|
|
|
|
|