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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:07:25+00:00 2026-05-28T16:07:25+00:00

I have a SQL Server 2008 table with a DateTime column that I’d like

  • 0

I have a SQL Server 2008 table with a DateTime column that I’d like to convert into 24h format.

The canonical guidance is to use something along the lines of:

select CONVERT(datetime, GetDate(), 121)

which yields:

2012-01-24 15:22:27.340

Perfect. Ok, so applying this knowledge, let’s replace GetDate() with a column for the CONVERT expression:

select top(5) CONVERT(datetime, LogTable.Timestamp, 121) from LogTable
order by LogTable.Id DESC

And we get:

2012-01-24 03:25:47.933
2012-01-24 03:25:46.917
2012-01-24 03:25:46.547
2012-01-24 03:25:46.543
2012-01-24 03:25:46.543

What am I doing wrong? How should the expression be crafted to get CONVERT to work on a column as opposed to the output of the GetDate() function?

  • 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-28T16:07:26+00:00Added an answer on May 28, 2026 at 4:07 pm

    I’ve managed to find the resolution to this issue: The service writing timestamps into the SQL table was, through bad formatting, writing “naked” datetimes into the field, effectively making them appear as “AM” irrespective of when they arrived.

    I managed to re-write the source code to write 24h datetimes into the field and it is now performing as expected. I am relieved to know my intuition was correct and it was an errant service that was the source.

    Thanks to everyone for their suggestions and guidance – very, very much appreciated!

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

Sidebar

Related Questions

I have a SQL Server 2008 database with a table that has a column
I have SQL Server 2008 with a table called ProductCategories designed like this: Id
I have a Money column in my SQL Server 2008 table. In my below
I have a table in a sql server 2008 database that contains bunch of
I have a table which contains my ads that can be searched in sql-server-2008.
I have a table that stores stock ticks in sql server 2008. It is
I have a table with a column that is a DATETIME in a SQL
I have a database column in a SQL Server 2008 database that contains VARCHAR
I am using SQL Server 2008. I have a table which has a datetime
I am using MS SQL Server 2008, and in a table I have column

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.