2014-01-07 43 views
0

我想知道有没有人可以帮忙?我需要将当前月份显示为2位数字段。 IE 月份为01 2月份02 三月03 等,直到 月10 十一月11 月12Crystal Reports将当前月份显示为2位数字段

我使用的公式为:ToText( “0” &月份(的currentdate)) 但显示为一月01.00 即需要去掉小数点和小数

非常感谢,罗布

回答

2

试试这个:

ToText(CurrentDate, "MM") 
0

ToText函数会自动将您提供的日期转换为您想要的任何格式。您不需要使用月份功能。根据文档,您只需提供日期和输出格式。本月,您使用“MM”。

ToText(CurrentDate, "MM") 

根据该机制的文档,这些都是有效的字符串,你可以使用

Pattern Result 
d  Numeric day of month without leading zero (1, 7, 31) 
dd  Numeric day of month with leading zero (01, 07, 31) 
ddd  Three day abbreviation of day of week (Mon, Sat) 
dddd  Full name of day of week (Monday, Saturday) 
M  Numeric month without leading zero (1, 7, 12) 
MM  Numeric month with leading zero (01, 07, 12) 
MMM  Three letter abbreviation of month (Jan, Feb, Mar) 
MMMM  Full name of month (January, February, March) 
yy  Last two digits of year (11, 14, 22) 
yyyy  Full four digits of year (2011, 2014, 2022) 
+0

怎么样周?如何始终显示2位数字(01,07,22)? – Kira

相关问题