DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Get Number Of Minutes From Hours (Simple Version)

04.07.2010
| 2275 views |
  • submit to reddit
        // Get the number of minutes from a date object's timestamp

function FormatMinutesFromHours(dateObject) {
    // Get the decimal value of hours
    var decimalTime = dateObject.getHours() + (dateObject.getMinutes() / 60);
    // Multiply by 60 and round to get the correct number of minutes
    return Math.round(decimalTime * 60);
}