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 8738419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:43:43+00:00 2026-06-13T10:43:43+00:00

When I am trying to convert date I am getting below error DECLARE @MinLogDate

  • 0

When I am trying to convert date I am getting below error

DECLARE @MinLogDate AS varchar(100)
DECLARE @MinDate AS DATETIME

SET @MinLogDate = '10/26/2012 01:23:90 AM'
SET @MinDate = (SELECT CONVERT(CHAR(10), CONVERT(datetime, @MinLogDate,103),101))

Error:

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

How can I convert the varchar time to datetime?

EDIT

based on the answer i have modified.. below is the actual date time i am getting .. so now I am able to get mindate but max date is not working

    DECLARE @MinDate AS DATETIME
    DECLARE @MaxDate AS DATETIME
    DECLARE @MinLogDate AS varchar(100)
    DECLARE @MaxLogDate AS varchar(100)

    SET @MinLogDate = '8/1/2012 01:00:00 AM'
    SET @MaxLogDate = '8/31/2012 01:00:00 PM'

    SET @MinDate = CONVERT(datetime, LEFT(@MinLogDate, 10), 101)
    SET @MaxDate = CONVERT(datetime, LEFT(@MaxLogDate, 10), 101)

    SELECT @MinDate
    SELECT @MaxDate
  • 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-13T10:43:45+00:00Added an answer on June 13, 2026 at 10:43 am

    Try this: CHANGE: As above answers I changed Date Format type 101 from 103.

    DECLARE @MinLogDate AS varchar(100)
    DECLARE @MinDate AS DATETIME
    
    SET @MinLogDate = '10/26/2012 01:23:10 AM'
    SET @MinDate = (SELECT CONVERT(CHAR(10), Replace(CONVERT(VARCHAR(20), Cast(@MinLogDate AS DATETIME), 101), '-', '/')))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to convert date/time from string to DateTime, I'm not getting the correct
I am trying to convert a date to datetime but am getting errors. The
Trying to convert date to specific format but getting error: <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
i'm trying to convert following varchar date to datetime format but it doesn't work
Im trying to convert unixtime to date but the results im getting are wrong
Here's the query I'm trying to convert into Linq: SELECT R.Code, R.FlightNumber, S.[Date], S.Station,
Why does this fail: DECLARE @DATE VARCHAR(50) = 'dasf' SELECT CASE WHEN ISDATE(@DATE) =
I'm trying to convert timestamp (NSTimeInterval) to date format. I'm getting the correct current
I am getting this error while I am trying to execute a simple SELECT
I am trying to convert decimal value to date in select statement SELECT user_id,

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.