# How to pass the same time to pre\_hook and dbt model query?

**URL:** <https://discourse.getdbt.com/t/how-to-pass-the-same-time-to-pre-hook-and-dbt-model-query/11512>\
**Category:** Help\
**Tags:** jinja, dbt-core\
**Created:** [January 11, 2024, 12:48pm UTC](https://discourse.getdbt.com/t/how-to-pass-the-same-time-to-pre-hook-and-dbt-model-query/11512 "2024-01-11T12:48:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![001atal](https://avatars.discourse-cdn.com/v4/letter/0/f4b2a3/32.png) [@001atal](https://discourse.getdbt.com/u/001atal)\
**Post date:** [January 11, 2024, 12:48pm UTC](https://discourse.getdbt.com/t/how-to-pass-the-same-time-to-pre-hook-and-dbt-model-query/11512/1 "2024-01-11T12:48:30Z")

</div>

I want to store current datetime in a variable using set in dbt model.

I want to pass the information of the datetime in two places, fist in pre\_hook query and second in the model query.

I have a dbt model code where I’ve assigned the current date and time to a variable called date\_time\_set . I call this variable in both pre\_hook and dbt model query. However, I noticed that I get different times in seconds at both places. I want to use the same time for both `pre_hook` and `dbt model` query. How can I achieve this?

```auto
{%- set date_time = modules.datetime.datetime.now() %}
{% set date_time_set%}
'{{date_time}}'
{% endset %}

```
