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

The Archive Base Latest Questions

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

In this code I just want that date and time are separate and I

  • 0

In this code I just want that date and time are separate and I just want to append that in a third variable so I write that code when I am typecast the time variable @t in to datetime for date it takes garbage value

Can you suggest any solution for that or any other simple way for the problem?

DECLARE @d AS time
declare @s as date
declare @t as datetime
declare @l as datetime
declare @q as datetime
set @s=(SELECT CONVERT(VARCHAR(10),GETDATE(),111))
set @d='6:00PM'
set @t=cast(@s As datetime)
set @l=CAST(@d as datetime)
set @q=(SELECT DateAdd(D,0,cast(@s As datetime)+CAST(@t as datetime)))
print @q
  • 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-25T16:35:12+00:00Added an answer on May 25, 2026 at 4:35 pm

    You need to cast the time as datetime and add it to the date :

    DECLARE @t AS time
    DECLARE @d AS date
    DECLARE @dt as datetime
    
    SET @t = '6:00PM'
    SET @d = '14 sep 2011'
    SET @dt = @d+cast(@t as datetime)
    
    select @d,@t,@dt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this code from someone and it works very well, I just want
This code does not seem to compile, I just need to write something to
I have a xml file that looks like this <a> <bb> <c date=20110706 time=1:20
I am working on const-correctness of my code and just wondered why this code
this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I just came across this code and a few Google searches turn up no
I just saw this code while studying the wordpress source code (PHP), You can
I just found this code in reflector in the .NET base libraries... if (this._PasswordStrengthRegularExpression
is it just me or this code in Programming Pearls is wrong (quicksort wants
I have just come across this code: function test(){ //... if ( $profilerule ==

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.