2014-01-07 41 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

相關問題