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

  • SEARCH
  • Home
  • 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 8448365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:24:27+00:00 2026-06-10T10:24:27+00:00

I have a database with date format yyyyymmdd’ and data-type varchar(8). In this case

  • 0

I have a database with date format “yyyyymmdd’ and data-type varchar(8). In this case when I need to find a data for whole month I used to write code like below :

  select * from table1
  where Date Between (convert(varchar(6),getdate(),112)+'01')
  AND (convert(varchar(6),getdate(),112)+'31'))

Now I just have a new table with date format “dd/mm/yyyy” and date type varchar(10) and I would like to extract data from the table for whole month without specifying exact date. I want start date as first day of current and month and end date as last day of the current month.

But I don’t now how to do the same as the date format is now ‘dd/mm/yyyy’.

  • 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-10T10:24:28+00:00Added an answer on June 10, 2026 at 10:24 am

    First, thing you should store you date as the datatype of date and not varchar

    You can use MONTH()

    SELECT *
    FROM yourTable
    WHERE MONTH(convert(datetime, dt, 103)) = MONTH(getdate()) -- or month you want
    

    or DATEPART()

    SELECT *
    FROM yourTable
    WHERE DatePart(month, convert(datetime, dt, 103)) = DatePart(month, getdate())
    

    See SQL Fiddle with Demo

    Both of these, get the value of the MONTH() — 8, 9, 10 — and then compares it to the month that you want.

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

Sidebar

Related Questions

In mysql database i have this column called: Name: Date Type: datetime I have
I have a database with date field is this format 2010.06.11. | 10:26 13
I have date database entries like the format 2011/01/08 06:10:11, but I need to
I have a sqlite3 database with a datetime field, the format of the date/time
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have data stored as below in an MS Access database: Date User 20090101
I have dates in a column of database but the date format is not
I have a form in which date format is dd/mm/yyyy . For searching database
i have a string field (and i can't change this because the date format)
I have a database field where date is stored as DD/MM/YYYY format. Now what

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.