开发者

How do I make my date field show in a particular format in crystal reports

开发者 https://www.devze.com 2023-03-23 03:24 出处:网络
I am a bit new to crystal reports even though开发者_JAVA技巧 I\'ve been doing a bit of heavy lifting with it.

I am a bit new to crystal reports even though开发者_JAVA技巧 I've been doing a bit of heavy lifting with it. I have this crystal report that has a datetime field. This field has a default datetime of 1753-01-01 00:00. Now I want this field to display only date like "01-03-2011" and also anywhere it sees the default date, it should display an empty string like ''. To achieve this I used this formular (in the display string)

if CurrentFieldValue = DateValue('1753-01-01 00:00:00') then
       ''
else
    totext(CurrentFieldValue)

This successfully changes the default date to empty string. But now I can no longer change the format to dates only.


I found my own workaround.

In case there is anyone who might be interested in the method I used, here it is

     if CurrentFieldValue = DateValue('1753-01-01 00:00:00') then 
        ''
     else
        totext(CurrentFieldValue, 0)

Can you imagine, just a little 0 after the currentFieldValue!


Here's another approach which will let you do the date formatting at the field level instead of the formula level:

if CurrentFieldValue <> DateValue('1753-01-01 00:00:00') then 
    CurrentFieldValue
0

精彩评论

暂无评论...
验证码 换一张
取 消