跳至內容
選單
此問題已被標幟
3 回覆
2328 瀏覽次數

so i have this line of code here

ir_sequence_date = str (fields.Date.today())[:10]

I don't understand what's the use of [:10] , does anyone have a clue what it's for?

頭像
捨棄

Please use a meaningful title.

最佳答案

To display only Date and not show time in that case will use. Example, 29/05/2020 date contain only 10 digits.

頭像
捨棄
最佳答案

Hi,

This will give you first 10 letters of the corresponding string. Suppose if str (fields.Date.today()) is abcdefghijkl  and if you do  str (fields.Date.today())[:10] ,  the result will be abcdefghij (first 10) .


Thanks

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 20
4954
3
10月 23
8682
1
9月 23
3261
1
5月 23
2225
2
4月 23
2767