picker time only

You must Login before you can answer or comment on any questions.

I am trying to have a window pop up and utilize the time part of the picker this is my code and when it executes it shows the date and not the time.

var dpwin3 = Ti.UI.createWindow({
        exitOnClose : true,
        backgroundColor:'black',
        layout : 'vertical'
    });
 
    var timepicker = Ti.UI.createPicker({
        type : Ti.UI.PICKER_TYPE_TIME,
        minuteInterval: 5,
        value : defaultResvTime
    });
 
    dpwin3.open();

— asked 8 months ago by Joe Winkiel
2 Comments
  • type: Ti.UI.PICKER_TYPE_DATE_AND_TIME

    — commented 8 months ago by nicolò monili

  • I only want the time displayeed not both

    — commented 8 months ago by Joe Winkiel

2 Answers

var dpwin3 = Ti.UI.createWindow({
    exitOnClose : true,
    backgroundColor : 'black',
    layout : 'vertical'
});
 
var timepicker = Ti.UI.createPicker({
    type : Ti.UI.PICKER_TYPE_TIME,
    minuteInterval : 5,
});
 
dpwin3.add(timepicker);
dpwin3.open();
This code works perfectly? So where is the issue?

Here is the actual code.

var defresvtimeChange =  Ti.UI.createButton({
    title:'Change',font:{fontWeight:'bold'},
    backgroundColor:'blue',color:'white',
    top:280, left:340, width:'auto', height:40
    });
    defresvtimeChange.addEventListener('click',function(e){
    var dpwin3 = Ti.UI.createWindow({
        exitOnClose : true,
        backgroundColor:'black',
        layout : 'vertical'
    });
 
    var timepicker = Ti.UI.createPicker({
        type : Ti.UI.PICKER_TYPE_TIME,
        minuteInterval: 5,
        value : defaultResvTime
    });
 
    dpwin3.open();
 
    timepicker.showTimePickerDialog({
        value : defaultResvTime,
        callback : function(e) {
            if (e.cancel) {
                Ti.API.info('User canceled dialog');
            } else {
                imtrsettingspage_label3ans.text = formatTime(e.value);
                defaultResvTime=e.value;
            }
            dpwin3.close();
        }
    }); 
 
});
imtrsettingspage.add(defresvtimeChange);

Your Answer

Think you can help? Login to answer this question!