Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
2384 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

Please use a meaningful title.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 20
5022
3
thg 10 23
8801
1
thg 9 23
3323
1
thg 5 23
2265
2
thg 4 23
2824