Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Confused about time expiration

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Confused about time expiration

    Hi, everyone. Im a little confused about this. The time is correct...however, when it shows the time expiration it is 5 hours behind. Does anyone know what could be the problem? Thanks.

    function validateTime(timeStr) {
    // Checks if time is in HH:MM:SS AM/PM format.
    // The seconds and AM/PM are optional.
    	if(timeStr == '') return false;
    	timeStr = timeStr.toUpperCase();
    	var timePat = /^(\d{1,2}):(\d{2})?(\s?(AM|am|PM|pm))?$/;
      var pm_times = 0;
    	var matchArray = timeStr.match(timePat);
    	hour = matchArray[1];
    	minute = matchArray[2];
    	ampm = matchArray[4];
    	if (ampm == 'PM' && hour < 12) pm_times = 12 * 3600;
    	return pm_times + (hour * 3600) + (minute * 60);
    }
     
    $(function() {
    	$('#nav').droppy({speed: 130});
      var options1 = {format: '%I:%M:%S %p'  }
    $('#jclock1').jclock(options1).addClass('ui-state-active ui-corner-all');
     
     
    $('#timeout').everyTime(5000,function(i) {
      var cookiename = 'time_left=';
      var ca = document.cookie.split(';');
      for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') 
        c = c.substring(1,c.length);
        if (c.indexOf(cookiename) == 0) {
          var data = c.substring(cookiename.length,c.length);
          data = unescape(data.replace(/\+/,' '));
          data = 'Session expires<br/>at ' + data;
        }
      }
      $('#timeout').html(data);
    }).addClass('ui-state-error ui-corner-all');


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Confused about time expiration

    Try asking this on a javascript forum.

Similar Threads

  1. [SOLVED] confused
    By joon in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 12th, 2011, 11:40 AM
  2. I'm confused...
    By acolar in forum Object Oriented Programming
    Replies: 1
    Last Post: April 14th, 2011, 12:14 PM
  3. Confused with Arrays
    By Solidius in forum Collections and Generics
    Replies: 3
    Last Post: October 29th, 2010, 09:54 AM
  4. Confused about setting up JSP
    By mjpam in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: September 17th, 2010, 05:14 AM
  5. Confusion with C/C++
    By Eric in forum Java Applets
    Replies: 0
    Last Post: December 22nd, 2008, 02:18 PM