PDA

View Full Version : how to set the time in a Date type


aEr_aEr
01-16-2003, 09:59 AM
hi,

I've got a javascripttime that i want to get in a ASP time

on one page i made a form that submits the hours, minutes an seconds.

So now I've got the hours, minutes and seconds on the second page in ASP. Now i want to make the date type on this page. This date must have the time from the javascript but the day, month and year from the now() function.

can onyone help me out here

raf
01-16-2003, 12:11 PM
use the time serial function to build the time and the date() function to get the date

info from helpfile
-------------------------------------------------------------------------

TimeSerial Function Language Reference
Version 1


See Also


--------------------------------------------------------------------------------

Description
Returns a Variant of subtype Date containing the time for a specific hour, minute, and second.
Syntax
TimeSerial(hour, minute, second)
The TimeSerial function syntax has these arguments:

Part Description
hour Number between 0 (12:00 A.M.) and 23 (11:00 P.M.), inclusive, or a numeric expression.
minute Any numeric expression.
second Any numeric expression.


Remarks
To specify a time, such as 11:59:59, the range of numbers for each TimeSerial argument should be in the accepted range for the unit; that is, 0–23 for hours and 0–59 for minutes and seconds. However, you can also specify relative times for each argument using any numeric expression that represents some number of hours, minutes, or seconds before or after a certain time.
The following example uses expressions instead of absolute time numbers. The TimeSerial function returns a time for 15 minutes before (-15) six hours before noon (12 - 6), or 5:45:00 A.M.

Dim MyTime1
MyTime1 = TimeSerial(12 - 6, -15, 0) ' Returns 5:45:00 AM.

When any argument exceeds the accepted range for that argument, it increments to the next larger unit as appropriate. For example, if you specify 75 minutes, it is evaluated as one hour and 15 minutes. However, if any single argument is outside the range -32,768 to 32,767, or if the time specified by the three arguments, either directly or by expression, causes the date to fall outside the acceptable range of dates, an error occurs.

aEr_aEr
01-16-2003, 12:39 PM
thanx for your help,

Where can i find info files, Like the one you posted for other functions.

allida77
01-16-2003, 02:19 PM
http://www.devguru.com/Technologies/vbscript/quickref/functions.html

http://www.w3schools.com/vbscript/vbscript_ref_functions.asp#date

raf
01-16-2003, 03:54 PM
my infofiles come from a free, excellent, little tool, that is supplied with Office pro.
Search your harddisk for mse.exe and open that file, then look in the helpfunction.