Skip to content
Advertisement

Why am I receiving this error? This date function has worked fine in my overall script until today

I am using this date function in a python script of mine and it has been working for months. Now, as of this morning it is not working. Here is an image of the error that I receive when I try and run the function. I receive the

error in script when running date function by itself.

date function that I’m using to format the date:

JavaScript

error that I receive after I try and run the function:

JavaScript

Here is the error that I receive when I try and run the entire script without isolating the function.

JavaScript

Advertisement

Answer

What you are doing is slicing an integer type formate_date(int)
that’s why you are getting an error.

Instead what you should do is to first convert your given parameter to string type.
which also makes your overall code look even cleaner.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement