cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get today's date in the local time zone?

Mado
Valued Contributor II

I am trying to get today's date in the local time zone:

from pyspark.sql.functions import * 
date = to_date(from_utc_timestamp(current_timestamp(), 'Australia/Melbourne'))

What I get using the above code is a column object.

How can I get its value in a variable? I tried ".first()" but it doesn't work on the column object.

image 

1 ACCEPTED SOLUTION

Accepted Solutions

Hemant
Valued Contributor II

Hi @Mohammad Saber​ , you can use pytz and datetime python package for your usecase,, attaching code snippet in below screen shot.

Screenshot 2023-03-27 000020 

Hemant Soni

View solution in original post

1 REPLY 1

Hemant
Valued Contributor II

Hi @Mohammad Saber​ , you can use pytz and datetime python package for your usecase,, attaching code snippet in below screen shot.

Screenshot 2023-03-27 000020 

Hemant Soni

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group