How do I extract part of a date with SQL?

You might often need to do this if you’re to aggregate daily data stretching over a longer time period and yet retain the timing

The standard way forward is to use the  date_part() function

Below you can find its syntax within some of the most widely used database environments

 

Curious for alternative approaches?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.