1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default Answered: Compare TimeField Value with Time From Date

    Answered: Compare TimeField Value with Time From Date


    Good day all!!!

    I'm have a timefield "TimeField01". I'm trying to get the time from the timefield and compare it with the time from new Date().

    I see in the documentation clearTime which removes the time from the date, but there is no clearDate. I would like to remove the date from the timefield and from new Date() and then compare the two times. How would I go about doing this???

  2. You can set the two dates to the same date, then using getTime() to convert them to miliseconds to compare.
    Code:
    function compareTime(time1, time2){
        time1.setFullYear(1970, 0, 1);
        time2.setFullYear(1970, 0, 1);
        return time1.getTime() - time2.getTime();
    }

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    You can set the two dates to the same date, then using getTime() to convert them to miliseconds to compare.
    Code:
    function compareTime(time1, time2){
        time1.setFullYear(1970, 0, 1);
        time2.setFullYear(1970, 0, 1);
        return time1.getTime() - time2.getTime();
    }

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    61
    Answers
    3
    Vote Rating
    0
    azinyama is on a distinguished road

      0  

    Default


    Thanks a lot... That worked...

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar