Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Date set hour function

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 138
    Comment on it

    Javascript Date.setHours() method sets the hours for a specified date according to local time. It set the hours, minutes, seconds, and milliseconds fields of a Date

    date.setHours(hours)
    
    date.setHours(hours, minutes)
    
    date.setHours(hours, minutes, seconds)
    
    date.setHours(hours, minutes, seconds, millis)
    

    hours
    The best and simple way to define it is as an integer between 0 (midnight) and 23 (11 p.m.) local time. It is being set as the new hours value of date.

    minutes
    As far as an an optional integer is concerned, it has to be between 0 and 59. It is supposed to be used as the new value (in local time) of the minutes field of date. There is no support for this argument prior to ECMAScript standardization.

    seconds
    Well, you can choose any optional integer between 0 and 59. You must use it as the new value (in local time) of the seconds field of date. Similar to minuted, this argument also doesnt not get any support prior to ECMAScript standardization.

    millis
    Here you have to use an optional integer between 0 and 999. Please use it as the new value (in local time) of the milliseconds field of date. Going by support, it is also not supported prior to ECMAScript standardization. The millisecond is representation of the adjusted date. Prior to ECMAScript standardization, this method returns nothing.

    for example:

    var dt = new Date( "Aug 28, 2008 23:30:00" );
        dt.setHours( 02 );
        console.log( dt ); 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: