# Any guidance on setting the date within a file path?

**URL:** <https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275>\
**Category:** Matillion ETL\
**Created:** [March 5, 2021, 1:55pm UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275 "2021-03-05T13:55:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DA190190](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@DA190190](https://matillioncommunity.discourse.group/u/DA190190)\
**Post date:** [March 5, 2021, 1:55pm UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275/1 "2021-03-05T13:55:22Z")

</div>

I'm using the fixed iterator to query a series of tables from source then landing it in Blob storage.

&nbsp;

Desired behaviour is to have the filepath name as **${tablename}\_${date loaded}**. Tablename works dynamically, but my date time doesn't work. I attempted a few options with ${.now()}, ${dt.now()} and a few other options with .format...

&nbsp;

Alternatively, I tried to evaluate the _date loaded_ variable with .now() then use ${date loaded} in the iterator, but no luck.

&nbsp;

Does anyone have any guidance?

---

<div class="post-metadata">

**Author:** ![DA190190](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@DA190190](https://matillioncommunity.discourse.group/u/DA190190)\
**Post date:** [March 5, 2021, 2:40pm UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275/2 "2021-03-05T14:40:48Z")

</div>

I used the Python component to force this value but not sure if that is the most ideal solution

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://matillioncommunity.discourse.group/u/Michael)\
**Post date:** [March 8, 2021, 7:52am UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275/3 "2021-03-08T07:52:19Z")

</div>

Hi [@DA190190](https://matillioncommunity.discourse.group/u/DA190190)​ ,

you can find some hints in the official documentation: https://documentation.matillion.com/docs/2711553

In my project, I have defined an Environment Variable as follows (copy this to your "Project"-\>"Manage Environment Variables" dialog:

**MATILLION\_date DateTime Copied Default placeholder for dynamically setting current timestamps. See https://snowflakesupport.matillion.com/customer/portal/articles/2711553-date-and-time-methods- 1900-01-01**

You can use this on the Database Query Component as follows (in this example, I use the source name, table name, and load date as file prefix for the staging files):

**${v\_src\_name}\_${v\_src\_table\_name}\_${MATILLION\_date.now().format("yyyy-MM-dd\_HH-mm-ss")}\_**

 ![0694G00000DIYf3QAH_0D74G000007iTHvSAM](https://us1.discourse-cdn.com/flex002/uploads/matillioncommunity/original/1X/0332450426a15983f63e418c80b9bb30a86b50d9.png)

Let me know if that works for you or if you have any questions.

---

<div class="post-metadata">

**Author:** ![DA190190](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@DA190190](https://matillioncommunity.discourse.group/u/DA190190)\
**Post date:** [March 9, 2021, 1:58pm UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275/4 "2021-03-09T13:58:25Z")

</div>

Thanks Michael. Just so that I understand - you made an environment variable with a default value of 1900-01-01, effectively a placeholder, then you re-evaluate that same variable with the .now() function?

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://matillioncommunity.discourse.group/u/Michael)\
**Post date:** [March 9, 2021, 2:31pm UTC](https://matillioncommunity.discourse.group/t/any-guidance-on-setting-the-date-within-a-file-path/1275/5 "2021-03-09T14:31:30Z")

</div>

Exactly. The important part is that you can't call the .now() function standalone, but you have to use the variable for this.

&nbsp;

Actually, it doesn't matter if it is an Environment variable or a Job variable. Both should work. But with the Environment Variable approach you can define it just once and then use it in all your jobs.
