Results 1 to 2 of 2

Thread: DateSerial

  1. #1
    Join Date
    Dec 1969

    Default DateSerial

    Is there a jscript function that is similar to DateSerial?

  2. #2
    Join Date
    Dec 1969

    Default RE: DateSerial

    Pretty long, but this is from MS help...<BR><BR>Date Object<BR>Enables basic storage and retrieval of dates and times.<BR><BR>dateObj = new Date()<BR>dateObj = new Date(dateVal)<BR>dateObj = new Date(year, month, date[, hours[, minutes[, seconds[,ms]]]]) <BR><BR>Arguments<BR>dateObj<BR><BR>Required. The variable name to which the Date object is assigned.<BR><BR>dateVal<BR><BR>Required. If a numeric value, dateVal represents the number of milliseconds in Universal Coordinated Time between the specified date and midnight January 1, 1970. If a string, dateVal is parsed according to the rules in the parse method. The dateVal argument can also be a VT_DATE value as returned from some ActiveX® objects.<BR><BR>year<BR><BR>Required. The full year, for example, 1976 (and not 76).<BR><BR>month<BR><BR>Required. The month as an integer between 0 and 11 (January to December).<BR><BR>date<BR><BR>Required. The date as an integer between 1 and 31.<BR><BR>hours<BR><BR>Optional. Must be supplied if minutes is supplied. An integer from 0 to 23 (midnight to 11pm) that specifies the hour.<BR><BR>minutes<BR><BR>Optional. Must be supplied if seconds is supplied. An integer from 0 to 59 that specifies the minutes.<BR><BR>seconds<BR><BR>Optional. Must be supplied if milliseconds is supplied. An integer from 0 to 59 that specifies the seconds.<BR><BR>ms<BR><BR>Optional. An integer from 0 to 999 that specifies the milliseconds.<BR><BR>Remarks<BR>A Date object contains a number representing a particular instant in time to within a millisecond. If the value of an argument is greater than its range or is a negative number, other stored values are modified accordingly. For example, if you specify 150 seconds, JScript redefines that number as two minutes and 30 seconds. <BR><BR>If the number is NaN, that indicates that the object does not represent a specific instant of time. If you pass no parameters to the Date object, it is initialized to the current time (UTC). A value must be given to the object before you can use it. <BR><BR>The range of dates that can be represented in a Date object is approximately 285,616 years on either side of January 1, 1970. <BR><BR>The Date object has two static methods that are called without creating a Date object. They are parse and UTC. <BR><BR>Error<BR>The following example illustrates the use of the Date object.<BR><BR>function DateDemo(){<BR> var d, s = "Today&#039s date is: "; //Declare variables.<BR> d = new Date(); //Create Date object.<BR> s += (d.getMonth() + 1) + "/"; //Get month<BR> s += d.getDate() + "/"; //Get day<BR> s += d.getYear(); //Get year.<BR> return(s); //Return date.<BR>}<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts