Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
2361 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 20
4988
3
ต.ค. 23
8721
1
ก.ย. 23
3293
1
พ.ค. 23
2237
2
เม.ย. 23
2783