تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
2359 أدوات العرض

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
مايو 20
4987
3
أكتوبر 23
8720
1
سبتمبر 23
3293
1
مايو 23
2237
2
أبريل 23
2782