Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Variable

Hi,

I want to add current_date into filename... It get from system time...

{ EX : abc_2018-06-13 00:27:27 }

Thanks,

Mathan.

5 Community Answers

Matillion Agent  

Kalyan Arangam —

Hi mathan,

Assuming you have a datetime variable called dt, here’s an expression to calculate today’s date, format it and append to a filename.

Filename_${dt.now().format(“yyyy/MM/dd”))}.csv

Please see the following link on using date and time functions with variables. The examples assume you have a job/project variable called dt of type datetime.

https://redshiftsupport.matillion.com/customer/en/portal/articles/2711553-date-and-time-methods?b_id=8915

You may also use a python script to calculate the appropriate date value and store in a variable.

Hope that helps

Best
Kalyan


Mathan Selvaraj —

Hi Kalyan,

How to set datetime variable into environment variable...

Thanks,

Mathan


Matillion Agent  

Kalyan Arangam —

Hi Mathan,

You may create a variable under “Project→Manage Environment Variables”

Please see the following link for information on variables and usage.

https://redshiftsupport.matillion.com/customer/en/portal/articles/2037630-variables

Best
Kalyan


Mathan Selvaraj —

Hi Kalyan,

I'm passing that parameter to environment variable...

I get filename like :: filename_${dt.now().format("yyyy-MM-dd")}.csv

Thanks,

Mathan


Matillion Agent  

Kalyan Arangam —

The only reasons i can think of is when the variable dt is not declared or you are providing the Expression under Default Value.

Please check the following -
- Have you declared an environment a variable dt of type datetime
- The expression you’ve provided should be under component properties and not under default value of a variable.

Best
Kalyan

Post Your Community Answer

To add an answer please login