Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

how to create custom date format in scenario variables

Obireddy
Level 2
how to create custom date format in scenario variables

Hi Team,

I want to create scenario variable as custom date format a yyyy-mm-dd or dd-mm-yyyy hh:mm:ss from now() function where it has T & Z characters in date time format.

 

could you please help on it how to create formals in defining scenario variable in scenario steps?

 

Thanks in advance.


Operating system used: windows

0 Kudos
1 Reply
Turribeach
import datetime
from dataiku.scenario import Scenario
scenario = Scenario()

my_date=datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
scenario.set_scenario_variables(my_date=my_date)
print("****** " + my_date)

 

[variables={"my_date": "2024-05-08T08:38:23Z"}]
[2024/05/08-08:38:23.047] [Exec-98379] [INFO] [process]  - ****** 2024-05-08T08:38:23Z

 

 

0 Kudos