+ Start a Discussion
ShaTShaT 

Enter Date time in 24 hour format instead of the "HH:MM AM/PM" format

Hi,

How can i insert time format in 24 hour in Datetime field.

Eg-User-added image

I want datetime to displayed as 10/03/2014 23:19



Thanks
ShaT
Ravikant kediaRavikant kedia
Datetime myDate= Datetime.newInstance(remindate, Time.newInstance(integer.valueof(selectedTimevalue.split(' ')[0].split(':')[0]), integer.valueof(selectedTimevalue.split(' ')[0].split(':')[1]), 0, 0));
Here remindate date is a your selected date .
And selectedTimevalue is a 


<apex:selectList id="startTime" styleClass="selreminder" value="{!selectedTimevalue}" onchange="selectedTimefun(this.value);" multiselect="false" size="1" >
                <apex:selectOptions value="{!timeList}" />      
 </apex:selectList>


if(timeList == NULL)
        {
            timeList = new List<SelectOption>();
            timeList.add(new SelectOption('00:00 AM', '12:00 AM'));
            timeList.add(new SelectOption('00:30 AM', '12:30 AM'));
            timeList.add(new SelectOption('01:00 AM', '1:00 AM'));
            timeList.add(new SelectOption('01:30 AM', '1:30 AM'));
            timeList.add(new SelectOption('02:00 AM', '2:00 AM'));
            timeList.add(new SelectOption('02:30 AM', '2:30 AM'));
            timeList.add(new SelectOption('03:00 AM', '3:00 AM'));
            timeList.add(new SelectOption('03:30 AM', '3:30 AM'));
            timeList.add(new SelectOption('04:00 AM', '4:00 AM'));
            timeList.add(new SelectOption('04:30 AM', '4:30 AM'));                      
            timeList.add(new SelectOption('05:00 AM', '5:00 AM'));
            timeList.add(new SelectOption('05:30 AM', '5:30 AM'));                      
            timeList.add(new SelectOption('06:00 AM', '6:00 AM'));
            timeList.add(new SelectOption('06:30 AM', '6:30 AM'));                       
            timeList.add(new SelectOption('07:00 AM', '7:00 AM')); 
            timeList.add(new SelectOption('07:30 AM', '7:30 AM'));                     
            timeList.add(new SelectOption('08:00 AM', '8:00 AM'));
            timeList.add(new SelectOption('08:30 AM', '8:30 AM'));                       
            timeList.add(new SelectOption('09:00 AM', '9:00 AM'));
            timeList.add(new SelectOption('09:30 AM', '9:30 AM'));                      
            timeList.add(new SelectOption('10:00 AM', '10:00 AM'));
            timeList.add(new SelectOption('10:30 AM', '10:30 AM'));                       
            timeList.add(new SelectOption('11:00 AM', '11:00 AM'));
            timeList.add(new SelectOption('11:30 AM', '11:30 AM'));                       
            timeList.add(new SelectOption('12:00 PM', '12:00 PM'));
            timeList.add(new SelectOption('12:30 PM', '12:30 PM'));                      
            timeList.add(new SelectOption('13:00 PM', '1:00 PM'));
            timeList.add(new SelectOption('13:30 PM', '1:30 PM'));                       
            timeList.add(new SelectOption('14:00 PM', '2:00 PM'));
            timeList.add(new SelectOption('14:30 PM', '2:30 PM'));                      
            timeList.add(new SelectOption('15:00 PM', '3:00 PM'));  
            timeList.add(new SelectOption('15:30 PM', '3:30 PM'));                    
            timeList.add(new SelectOption('16:00 PM', '4:00 PM'));
            timeList.add(new SelectOption('16:30 PM', '4:30 PM'));                       
            timeList.add(new SelectOption('17:00 PM', '5:00 PM'));
            timeList.add(new SelectOption('17:30 PM', '5:30 PM'));
            timeList.add(new SelectOption('18:00 PM', '6:00 PM')); 
            timeList.add(new SelectOption('18:30 PM', '6:30 PM'));                     
            timeList.add(new SelectOption('19:00 PM', '7:00 PM'));
            timeList.add(new SelectOption('19:30 PM', '7:30 PM'));                       
            timeList.add(new SelectOption('20:00 PM', '8:00 PM'));
            timeList.add(new SelectOption('20:30 PM', '8:30 PM'));                       
            timeList.add(new SelectOption('21:00 PM', '9:00 PM'));
            timeList.add(new SelectOption('21:30 PM', '9:30 PM'));                       
            timeList.add(new SelectOption('22:00 PM', '10:00 PM'));
            timeList.add(new SelectOption('22:30 PM', '10:30 PM'));                       
            timeList.add(new SelectOption('23:00 PM', '11:00 PM'));
            timeList.add(new SelectOption('23:30 PM', '11:30 PM'));                       
        } 
    }
   
Similer to time  you can split date and then store in that time.


ShaTShaT
Thanks for your reesponse but i dont this with apex. Just want to achevie with standerd funtionality