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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:07:54+00:00 2026-06-15T20:07:54+00:00

Hi i have the following Code : Dim CurrentDate CurrentDate = Date() Dim intHour

  • 0

Hi i have the following Code :

Dim CurrentDate
CurrentDate = Date()

Dim intHour
Dim intMinute
Dim intSecond

intHour = 17
intMinute = 0
intSecond = 0

Dim NewDate
Dim NewDate1
Dim NewDate2

NewDate = DatePart("yyyy", CurrentDate)
NewDate1 = DatePart("m", CurrentDate)
NewDate2 = DatePart("d", CurrentDate)


Dim Dates 

Dates = DateSerial(NewDate, NewDate1, NewDate2)

Dim Time 

Time = TimeSerial(intHour, intMonth, intSecond)

I have done something equal in VB:

    Dim value As Date = Date.Now
    Dim intHour As Integer
    Dim intMinute As Integer
    Dim intSecond As Integer


    intHour = 17
    intMinute = 0
    intSecond = 0

    Dim newdatetime As DateTime = New Date(value.Year, value.Month, value.Day, intHour, intMinute, intSecond)

In VB i can do

Dim newdatetime As DateTime = New Date(value.Year, value.Month, value.Day, intHour, intMinute, intSecond).

In my ASP Code i have Dates = DateSerial(NewDate, NewDate1, NewDate2) and Time = TimeSerial(intHour, intMonth, intSecond). How can i put them together as DateTime like in VB?

  • 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-15T20:07:55+00:00Added an answer on June 15, 2026 at 8:07 pm

    Two ways:

    dim h,n,s
    h = 17
    n =  1
    s =  2
    
    dim t
    t = timeserial(h,n,s)
    
    dim d
    d = date()
    dim ts1
    ts1 = dateadd("h",h, _
          dateadd("n",n, _
          dateadd("s",s, d )))
    dim ts2
    ts2 = d + T
    

    Both produce the same output. The one with the additions has some gotchas depending on how close to day 0 you play it. I think the first way is “saner”. As far as I recall VBScript just stored the date part in the integer or a float and the time part in the fraction part of a float (as parts of a 24 hour day, so 12:00 is 0.5), hence you can just add them together with +

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

Sidebar

Related Questions

I have the following code in vb6 - dim iFreeFile as integer iFreeFile =
I have the following code to get the object type of a collection: Dim
i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
I have the following code: Private Sub SortWorksheet(ByVal sheet As Worksheet) Dim sStartColumn Dim
I have the following code : Dim L as Integer Dim R as Integer
I have the following code: Dim dbHousing As New dcHousingDataContext Dim pullresidents = From
I have the following code: Dim lStatementText As String Dim lStatementString As New System.Text.StringBuilder
I have the following code; Dim rdr As SqlCeDataReader = cm_sel.ExecuteReader If rdr.HasRows Then
I have a Server side variable by the following code Dim mgps As New
I have the following code: Dim i As Integer = dtResult.Rows.Count For i =

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.