Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8493889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:08:41+00:00 2026-06-10T23:08:41+00:00

till today when i was working with MySQL and needed to perform actions with

  • 0

till today when i was working with MySQL and needed to perform actions with date/time i was using int column with unix timestamp and there was no problems, but today after reading some guides i decided to test timestamp column with “current_timestamp” by default.

So i am interested how to select last month data by column where info is in “2012-09-07 00:23:30” format? And maybe there some tricky queries what will give me data from the start of this month (not last 30 days, but from 09-01 00:00:00 till today) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:08:43+00:00Added an answer on June 10, 2026 at 11:08 pm

    This will give you the last month:

    WHERE dateColumn BETWEEN SUBDATE(CURDATE(), INTERVAL 1 MONTH) AND NOW();
    

    This from the start of the month:

    WHERE dateColumn BETWEEN STR_TO_DATE('2012-09-01', '%Y-%m-%d') AND NOW();
    

    The BETWEEN is nothing special, it’s just a shortcut for

    dateColumn <= ... AND dateColumn >= ....
    

    Hmm, I guess the NOW() comparison is not actually needed, since all the records will be before now.

    So just do:

    WHERE dateColumn >= STR_TO_DATE('2012-09-01', '%Y-%m-%d')
    

    Dynamic start of current month:

    WHERE dateColumn >= CURDATE() - INTERVAL DAY(CURDATE())-1 DAY
    

    All this does is extract the day of the month from the current date, then subtract that many days less one from it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MySQL Workbench was working fine till today. I installed the regular updates and now
Till today I am using DateTime.Now; function to save the time and data of
I am php page everything was working fine till today morning. Now the page
Till yetsterday everything was working fine on my iPhone. Starting today, I noticed that
I have a big problem. I had a configuration which worked properly till today.
till now i was using drawable to populate marker on my map .Now i
I've been using RVM for quite some time now and have been very happy
Till recently i've needed to run the dev environment for my Heroku (postgres) app
Till now, I was using VB for developing applications. Now I have to use
I have been working in a project that have been working wothount problems till

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.