How to pass the same time to pre_hook and dbt model query?

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?

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