Skip to main content

Command Palette

Search for a command to run...

Using FORMAT_DATE in BigQuery

Updated
1 min read
Using FORMAT_DATE in BigQuery
C

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified

The code we write daily as Data Engineers is not necessarily complicated.

We're solving a lot of problems like the following:

Given a schedule per day of the week (Monday hours are 10:00 - 22:00 / 10 am - 10 pm), find out what was the schedule for a list of calendar days.

Here's how a BigQuery solution could look like:
- using FORMAT_DATE we can extract the abbreviated week day (%a in the list of format elements for date and time parts, attached in comments)
- transform that match casing of the joined column
- (INNER) JOIN

How would your solution to such a problem look like?

Found it useful? Subscribe to my Analytics newsletter at notjustsql.com.

Practical SQL

Part 1 of 50

Short, practical posts on SQL and BigQuery — from core language features to advanced query patterns. A reference for data practitioners at every level.

More from this blog

D

Datawise: A blog on SQL, BigQuery, Analytics, Python Tips and Tricks

204 posts

Data Engineer with a passion for transforming complex data landscapes into insightful stories. Here on my blog, I share insights, challenges, and the ever-evolving dance of technology and business.