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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:05:48+00:00 2026-05-26T17:05:48+00:00

I want to get records from sql server 2005 in datetime format like this

  • 0

I want to get records from sql server 2005 in datetime format like this “dd/mm/yyyy h:m:s”

My database date is default datetime format

AttLogId int
...
DownloadLog datetime

I am trying to retrieve the datetime like this:

SELECT AttLogId ,convert(varchar,DownloadLogDate,103) FROM  AttLog
ORDER BY DownloadLogDate

but I only get the date and not the time.

  • 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-05-26T17:05:49+00:00Added an answer on May 26, 2026 at 5:05 pm

    I suggest you don’t try to get the values in a particular string format. Fetch them as DateTime values and then format them in the .NET code using DateTime.ToString("dd/MM/yyyy H:m:s").

    It’s almost always worth keeping data in its “natural” data type (date/time here) for as long as possible, only converting to text when you really need to. So your SQL should just be:

    SELECT AttLogId, DownloadLogDate FROM  AttLog
    ORDER BY DownloadLogDate
    

    How you then retrieve the data will depend on how you’re talking to SQL (e.g. LINQ to SQL, using SqlDbReader etc). But you should be able to get it as a DateTime and then format it locally. This will make it easier to test, easier to debug, give you more control over cultural aspects (date separators, possibly specifying a standard specifier instead of a custom one, etc).

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

Sidebar

Related Questions

I'm inserting records from one sql server db into another. I need to get
I want to get all the records from the one table which contain at
Suppose you want to get a record from database which returns a large amount
I want to get the records of last month based on my database table
I have this query statement and want to only get records that has a
I want to get the MD5 Hash of a string value in SQL Server
i have a large sql server db, and i want to get the schema
Is there any way to get the functionality of the Sql Server 2005+ Sequential
I need to copy some records from our SQLServer 2005 test server to our
I want to limit a report to return records from Date A through Date

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.