SQL Dates Finally Made Sense: NOW, AGE, EXTRACT, and Why…
    Neura MarketNeura Market/DeepSeek
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityTrending
    DeepSeekBlogSQL Dates Finally Made Sense: NOW, AGE, EXTRACT, and Why Time Is Weird
    Back to Blog
    SQL Dates Finally Made Sense: NOW, AGE, EXTRACT, and Why Time Is Weird
    sql

    SQL Dates Finally Made Sense: NOW, AGE, EXTRACT, and Why Time Is Weird

    Jessica Aki January 20, 2026
    0 views

    Up until now, SQL felt very… solid. Numbers are numbers. Strings are strings. GROUP BY either works...

    Up until now, SQL felt very… solid.

    Numbers are numbers. Strings are strings. GROUP BY either works or it doesn’t.

    Dates? Dates humbled me.

    Today I spent time learning how SQL handles time and I finally understand why people say dates are one of the hardest parts of databases.

    This post is me documenting what clicked, what confused me, and what I’ll definitely need to revisit.


    The First Surprise: Dates Are Not Just Numbers or strings

    At first, I thought dates were just formatted numbers .

    Turns out they’re not. Dates come with:

    • time zones
    • hidden time components
    • built-in functions that behave differently depending on context

    Once I accepted that, things started to make more sense.


    NOW() — The Current Moment

    The simplest place to start was NOW().

    SELECT NOW();
    

    This returns the current timestamp**, that is, it's not just the date, but the exact moment the query runs.

    What clicked for me:

    • NOW() includes date and time, including the time zone
    • It’s commonly used for logs, audits, and tracking events

    Seeing a real timestamp come back made SQL feel a lot more like a backend system, not just a learning exercise.


    AGE() — Time Between Two Dates

    This function confused me at first, mostly because of the example usage i saw.

    SELECT AGE(date_of_birth);
    

    This example was where a users date of birth was passed into the function and the age was produced, but what I didn't understand at the time was that it's more flexible than just getting the difference between now and that day.

    SELECT AGE(DATE '2025-10-10', '2021-01-10'); 
    -- The amount of time I spent in Univeristy
    

    What AGE() actually does:

    • Returns the time difference between two timestamps
    • The result is an interval, not a number

    This is important.

    Instead of giving me days or seconds, it returns something like:

    4 years 9 mons

    This made sense for things like:

    • How old an account is
    • How long ago something happened
    • Time since last activity

    EXTRACT() — Pulling Out Pieces of Time

    This is where things started clicking properly.

    Sometimes you don’t want the full date. You just want part of it.

    SELECT EXTRACT(YEAR FROM  AGE(DATE '2025-10-10', '2021-01-10')); --4
    SELECT EXTRACT(MONTH FROM  AGE(DATE '2025-10-10', '2021-01-10')); --9 
    SELECT EXTRACT(DAY FROM  AGE(DATE '2025-10-10', '2021-01-10')); --0
    SELECT EXTRACT(DOW FROM  '2025-10-10'); --5 (Friday)
    -- DOW is Day of the week, it returns a value between 0 and 6 to represent the day of the week with Sunday being 0
    

    What finally made sense:

    • EXTRACT doesn’t change the date
    • It reads a specific part of it

    This is useful for:

    • grouping by year or month
    • filtering specific periods
    • reporting trends over time

    Once I saw it as “reading metadata from time”, not transforming it, it felt less magical.


    Intervals — Time as a Data Type

    This part surprised me.

    Time differences aren’t just numbers, rather SQL treats them as intervals.

    SELECT NOW() - INTERVAL '7 days';
    SELECT NOW() + INTERVAL '1 month';
    

    That means SQL understands:

    • days
    • months
    • years
    • hours, minutes, seconds

    And it handles calendar logic for you.

    No manual math. No guessing.


    What Still Feels Weird

    I’m being honest, some things still feel slippery:

    • Time zones (I know this will bite me later)
    • Comparing dates vs timestamps
    • Understanding when time gets truncated or rounded

    But compared to yesterday, I’m no longer scared of date functions.

    That’s progress.


    Conclusion

    Dates are usually taught quickly, like:

    “Here’s NOW(). Here’s EXTRACT(). Moving on.”

    But as a beginner, this isn’t about syntax. It’s about understanding how databases think about time.

    If dates confused you too, you’re not behind. They confuse everyone.


    I’m learning SQL slowly, properly, and in public and documenting both the clarity and the confusion.

    If you’re on the same path, you’re not alone. You can join me on this series and learn with me.

    — Jessica Aki Data and Database Engineering Enthusiast

    I’m documenting my journey into data engineering learning SQL, databases, and the systems behind modern data platforms.

    Tags

    sqldatabasepostgresbeginners

    Comments

    More Blog

    View all
    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught megemma

    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught me

    I ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...

    X
    xbill
    Hey DEV, I'm Tobore. Let's actually connect.community

    Hey DEV, I'm Tobore. Let's actually connect.

    Hey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...

    L
    Laurina Ayarah
    I burned through thousands of AI tokens. Then a friend did it for freeai

    I burned through thousands of AI tokens. Then a friend did it for free

    (yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...

    P
    Paulo Henrique
    Claude might be saturating your machineai

    Claude might be saturating your machine

    My laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...

    S
    Sidhant Panda
    Automated GitHub Code Reviews Using Google Geminigithubactions

    Automated GitHub Code Reviews Using Google Gemini

    I Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...

    D
    Darren "Dazbo" Lester
    What is an "agentic harness," actually?ai

    What is an "agentic harness," actually?

    I've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...

    T
    Tilde A. Thurium

    Stay up to date

    Get the latest DeepSeek prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for DeepSeek and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions for your business.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this DeepSeek resource

    • Automate Blog Content Creation with Notion MCP, DeepSeek AI, and WordPressn8n · $9.99 · Related topic
    • Extract Text from Images & PDFs via Telegram with Mistral OCR to Markdownn8n · $24.99 · Related topic
    • Extract Data from YAPE Receipts via Telegram OCR and Store in Google Sheetsn8n · $24.99 · Related topic
    • Extract & Analyze Competitor Reviews with Firecrawl & GP-40 Mini for Intelligence Reportsn8n · $24.99 · Related topic
    Browse all workflows