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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:19:00+00:00 2026-06-15T19:19:00+00:00

A silly question maybe but I wanted clarification. I’ve created a script that has

  • 0

A silly question maybe but I wanted clarification. I’ve created a script that has a date parameter like so:

DECLARE @dateparam as datetime
SET @dateparam = '01-01-2013 00:00:00'

This looks like it is working when I test it even if the date string is not in “correct” format yyyy-MM-dd hh:mm:ss. I changed my computer regional settings to English and the script still did what it was supposed to do.

Is this because of SQL Server 2008 R2 that I have in my computer that it knows how to convert the date or can I ran into trouble with using a dateformat like I have used?

  • 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-15T19:19:01+00:00Added an answer on June 15, 2026 at 7:19 pm

    Converting 01-01-2013 won’t expose issues such as which 01 is the month, and which is the day.

    It’s not a safe format.

    The safe formats (for converting to datetime, rather than to datetime2) are:

    YYYYMMDD                               20121201
    YYYY-MM-DD'T'hh:mm:ss                  2012-12-01T10:43:29
    YYYY-MM-DD'T'hh:mm:ss.mil              2012-12-01T10:43:29.337
    

    Stick to those and only those. (The examples all represent the 1st December 2012)

    Or, better yet, don’t treat dates as strings at all, if you can avoid it. If you’re, for example, calling SQL Server from .NET code, keep that dates as DateTimes in your code, and let ADO.NET and SQL Server deal with any required translations to make them become datetimes – without translating them to and from strings.

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

Sidebar

Related Questions

Maybe this is a silly question, but I'm working on a project that wants
Maybe that's a silly question... But what's the best (performance and memory wise) way
Maybe a silly question, I can read all the properties from list parameter but
It this possible? How? (Maybe silly question, but I couldn't find answer :( )
Ok so this maybe a simple/silly question but I don't know so here goes:
I downloaded their emoticons and it is a silly question maybe but can I
Maybe the question sounds silly, but I don't understand 'something about threads and locking
Maybe this question is kind of silly but I have no clue how to
This question may be silly but i accidentally checked in java source code that
Maybe silly question to the JS gurus and ninjas out there but here goes:

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.