Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Checking time problem

$
0
0

I'm trying to check the stored time with the current time and check what is bigger.

To do so I make a request to an url to get the time... local time does not help me in that situation.

var xhr = Ti.Network.createHTTPClient({
    onerror:function(e){
        alert( e.error );
    },
 
    onload:function(e){
 
        var result = this.responseText;
 
        var storedTime = Ti.App.Properties.getString( 'stored' );
 
        if( result > storedTime ){
            Ti.API.info( 'result is bigger than storedTime' );
 
        }else if( result < storedTime ){
            Ti.API.info( 'storedTime is bigger than result' );
        }
    }
})
 
xhr.open( 'GET', url );
xhr.send();

My problem is... if my storedTime is like 23:00:00 and my result time is 01:00:00 on my if it says that my storedTime is bigger since 23 is bigger than 1 but on days time 1 AM is bigger than 23 PM

How can I assume that 01:00:00 is bigger than 23:00:00 ?

Thank you.

3.1.2 GA iPhone Android


Viewing all articles
Browse latest Browse all 8068


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>