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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:44:05+00:00 2026-05-27T10:44:05+00:00

I have table Proccesses that consist of Date Time Field. Proccesses ( Id as

  • 0

I have table Proccesses that consist of Date Time Field.

Proccesses ( Id as int , RunDate as DateTime)
I need to run Distinct by RunDate as Time Without seconds

For Example

ID        RunDate 
1         2011-12-13 12:36:26.483
2         2011-12-12 12:37:22.421
3         2011-12-11 12:36:44.421

I need to receive in output

Output
12:01
12:03

In order to retrieve it I using following SQL and it’s working

SELECT DISTINCT DATENAME(hour, RunDateTime) + ':' + 
DATENAME(mi, RunDateTime) AS  d
from Proccesses 

The problem that if minutes is less than 10 for example 8
I receiving single digit “8” , and I want to receive two digit 08

For example I receive 12:8 , and I need to receive 12:08

  • 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-27T10:44:06+00:00Added an answer on May 27, 2026 at 10:44 am

    try

    SELECT DISTINCT 
    RIGHT ('00' + CAST(DATENAME(hour, RunDateTime) AS VARCHAR(2)), 2) + ':' +
    RIGHT ('00' + CAST(DATENAME(mi, RunDateTime) AS VARCHAR(2)), 2)
    from Proccesses 
    

    Alternatively you can use CONVERT as suggested by @JoeStefanelli and handle the string result accordingly.

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

Sidebar

Related Questions

I have table Proccesses that consist of Date Time Field. Proccesses ( Id as
I have a table that records the success/failure of a particular job run for
Currently I have a powershell proccess that is scanning a SQL Server Table and
I have table with around 70 000 rows. There is 6000 rows that i
I have table in which I am inserting rows for employee but next time
I have table of data that is sorted as follows: Item | Sample |
Ok this is the scenario... I have a table in Oracle that acts like
I have a script that processes queued records in a SQL table in SQL
I have a SQL Server table full of orders that my program needs to
We have a system that processes records by a priority number in a table.

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.