Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Python line length
  • Loading branch information
srowen committed Sep 19, 2017
commit 87874b6d44731158ae82d432e65946809332c5f4
10 changes: 6 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,8 +1150,9 @@ def unix_timestamp(timestamp=None, format='yyyy-MM-dd HH:mm:ss'):
@since(1.5)
def from_utc_timestamp(timestamp, tz):
"""
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders that time as a
timestamp in the given time zone. For example, 'GMT+1' would yield '2017-07-14 03:40:00.0'.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders
that time as a timestamp in the given time zone. For example, 'GMT+1' would yield
'2017-07-14 03:40:00.0'.

>>> df = spark.createDataFrame([('1997-02-28 10:30:00',)], ['t'])
>>> df.select(from_utc_timestamp(df.t, "PST").alias('local_time')).collect()
Expand All @@ -1164,8 +1165,9 @@ def from_utc_timestamp(timestamp, tz):
@since(1.5)
def to_utc_timestamp(timestamp, tz):
"""
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time zone, and renders
that time as a timestamp in UTC. For example, 'GMT+1' would yield '2017-07-14 01:40:00.0'.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time
zone, and renders that time as a timestamp in UTC. For example, 'GMT+1' would yield
'2017-07-14 01:40:00.0'.

>>> df = spark.createDataFrame([('1997-02-28 10:30:00',)], ['ts'])
>>> df.select(to_utc_timestamp(df.ts, "PST").alias('utc_time')).collect()
Expand Down