Convert datetime tag into formatted string into script

I have a datetime tag the users pick up with a calendar object.

Inside a script (defined in a script module) I wanto to convert it to format YYYYMMDD to pass as a parameter of a query to my sql server

Inside the script I get the value with

If I convert using str() I get the full string including time and timezone.

I tried with .strftime but is not working

Can you post what you’ve done and tell us what’s not working about it? I would have thought that time.strftime would do the job…