currrent time showing always utc while utc+2 zone is setting

Viewed 68

i want to add the timestamp to container logs. i did in my build stage but im gotting always the timestamp UTC and not UTC+2(paris local time):

stage: build
 script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- echo "ETL_IMAGE = \""$CI_IMAGE_COMMIT_TAG"\"" > version.py
- docker build --pull --tag $CI_IMAGE_COMMIT_TAG .
- export current_date=$(TZ="Europe/Paris" date +"%m-%d-%Y_%H:%M:%S")
- echo $current_date
- docker push $CI_IMAGE_COMMIT_TAG

Please who can help me?? print_current°date

1 Answers

Why don't you just set the TZ environment variable on the container level?

your_job:
  variables:
    TZ: Europe/Paris
  script:
    - export current_date=$(date +"%m-%d-%Y_%H:%M:%S")
    - echo $current_date
Related