Skip to Content
Menu
This question has been flagged
3 Replies
2336 Rodiniai

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?

Portretas
Atmesti

Please use a meaningful title.

Best Answer

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

Portretas
Atmesti
Best Answer

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
geg. 20
4954
3
spal. 23
8684
1
rugs. 23
3261
1
geg. 23
2225
2
bal. 23
2767