Problem system.date.format

Hello, I have a problem that i can’t understand on my script.

When I try to get a Data of my event stored on my database, I have error bellow

Someone can tell where is the problem please?

you can use “print type(today)” to see if the data type of the self.view.params.startTime is a string or not.
may be you should firstly convert it to a valid date type by system.date.parse.

thank you for your anwser.
when I use today, it work but I can’t use it because I want get StartTime of my event stored on the database.

The format of date obtened

1 Like

thank you Sir

A couple of suggestions.

When posting scripts, instead of posting a screen shot post the text in between triple quotes. That will preserve your formatting, let you edit out confidential parts, and is easier to read.

Also, instead of using
year = int(system.date.format(today, 'yyyy'))
try
year = system.date.getYear(today)

It’s a bit easier to read and less prone to error. Docs.