www.webdeveloper.com
Results 1 to 3 of 3

Thread: Military to Standard Time

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Military to Standard Time

    I need some help altering this script section to go from military to standard time. Im not real strong with java and not certain how to do it, the research i have done did not make much sense.

    Code:
    									var start_time_hours = start.getHours();
    									
    									if(start_time_hours < 10) { start_time_hours = "0" + start_time_hours; }
    									var start_time_minutes = start.getMinutes();
    									if(start_time_minutes < 10) { start_time_minutes = start_time_minutes + "0"; }
    									
    									// adding AM-PM in Start Time
    									var bk_st_time = start_time_hours + ':' + start_time_minutes;
    									if(start_time_hours < 12){ bk_st_time = bk_st_time + "AM";} else { bk_st_time = bk_st_time + "PM";}
    									/*document.myform.st.value = bk_st_time;*/
    
    									var end_time_hours = end.getHours();
    									var end_time_minutes = end.getMinutes();
    									if(end_time_hours < 10) { end_time_hours = "0" + end_time_hours; }
    									if(end_time_minutes < 10) { end_time_minutes = "0" + end_time_minutes; }
    									
    									// adding AM-PM in End Time
    									var bk_end_time = end_time_hours + ':' + end_time_minutes;
    									if(end_time_hours < 12){ bk_end_time = bk_end_time + "AM";} else { bk_end_time = bk_end_time + "PM";}
    									/*document.myform.edt.value = bk_end_time;*/
    									
    									var mm = start.getMonth()+1;
    									
    									var booking_date = start.getFullYear() + '-'+ mm + '-' + start.getDate();
    									document.myform.bookdate.value = booking_date;
    									
    									calendar.fullCalendar('Unselect');

  2. #2
    Join Date
    Dec 2012
    Posts
    2
    Sorry here is a better view

    Code:
    var start_time_hours = start.getHours();
    
    if(start_time_hours < 10) { start_time_hours = "0" + start_time_hours; }
    var start_time_minutes = start.getMinutes();
    if(start_time_minutes < 10) { start_time_minutes = start_time_minutes + "0"; }
    								
    // adding AM-PM in Start Time
    var bk_st_time = start_time_hours + ':' + start_time_minutes;
    if(start_time_hours < 12){ bk_st_time = bk_st_time + "AM";} else { bk_st_time = bk_st_time + "PM";}
    /*document.myform.st.value = bk_st_time;*/
    
    var end_time_hours = end.getHours();
    var end_time_minutes = end.getMinutes();
    if(end_time_hours < 10) { end_time_hours = "0" + end_time_hours; }
    if(end_time_minutes < 10) { end_time_minutes = "0" + end_time_minutes; }
    								
    // adding AM-PM in End Time
    var bk_end_time = end_time_hours + ':' + end_time_minutes;
    if(end_time_hours < 12){ bk_end_time = bk_end_time + "AM";} else { bk_end_time = bk_end_time + "PM";}
    /*document.myform.edt.value = bk_end_time;*/
    								
    var mm = start.getMonth()+1;
    						
    var booking_date = start.getFullYear() + '-'+ mm + '-' + start.getDate();
    document.myform.bookdate.value = booking_date;
    							
    calendar.fullCalendar('Unselect');

  3. #3
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,268
    What is Military time ?
    A string with four (or six digits for the seconds) followed by a timezone letter (see this wikipedia page)?
    Or always with a Z (Zoulou or UTC time) or a J (Juliet for local time) ?

    This decoded Metar of Paris Charles de Gaulle Airport is an example. The original Metar is the penultimate line (with the Zoulou time after LFPG).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles