# A time picker for Ionic framework applications

**URL:** <https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409>\
**Category:** demo\
**Created:** [December 1, 2014, 4:40am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409 "2014-12-01T04:40:12Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [September 11, 2015, 6:00am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/62 "2015-09-11T06:00:07Z")

</div>

Create a codepen or plunker and give me the link. I will try to help you. By the way this forum thread is for `ionic-timepicker` component, not for the `ionic-datepicker`. Please post anything related to `ionic-datepicker` [here](http://forum.ionicframework.com/t/ionic-datepicker-bower-component-for-ionic-framework-applications/21516)

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [October 8, 2015, 11:09am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/63 "2015-10-08T11:09:54Z")

</div>

Hi Guys, Thanks for all of you, for helping me to fix bugs. I have released a new version of [ionic-timepicker v0.4.0](https://github.com/rajeshwarpatlolla/ionic-timepicker/releases/tag/v0.4.0). Please use this new version from now on.

---

<div class="post-metadata">

**Author:** ![Anuja](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Anuja](https://forum.ionicframework.com/u/Anuja)\
**Post date:** [October 15, 2015, 9:43am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/64 "2015-10-15T09:43:05Z")

</div>

i need help to customize the datepicker from seleted day i want to disabled the dates before seleted day

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [October 15, 2015, 9:56am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/65 "2015-10-15T09:56:52Z")

</div>

Please continue this thread at [this link](http://forum.ionicframework.com/t/a-date-picker-for-ionic-framework-applications/21515), as this is related to the **ionic-datepicker**.

If you want to disable the dates past to the selected dates you can pass the `from : selectedDate`, then it will disable the dates past to the given date(In our case past past to the **selectedDate** ).

---

<div class="post-metadata">

**Author:** ![sgurusam](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sgurusam](https://forum.ionicframework.com/u/sgurusam)\
**Post date:** [January 2, 2016, 8:03am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/66 "2016-01-02T08:03:51Z")

</div>

After some bit of research on what date & time picker to use for my app. I decided to go with HTML5 date & datetime-local, they have great UI in android & iOS. For testing, use chrome browser for testing. This is perfect as no plugin needs to be installed.

example at [http://ionicframework.com/html5-input-types/#date](http://ionicframework.com/html5-input-types/#date)  
[http://www.w3schools.com/html/html\_form\_input\_types.asp](http://www.w3schools.com/html/html_form_input_types.asp) ( see datetime-local)

---

<div class="post-metadata">

**Author:** ![losewin](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@losewin](https://forum.ionicframework.com/u/losewin)\
**Post date:** [January 20, 2016, 3:43am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/67 "2016-01-20T03:43:02Z")

</div>

I got this error when using the Timepicker… how do I solve this ?  
I follow the example code

`{"inputEpochTime":39600,"step":15,"format":12,"titleLabel":"12-hour Format","setLabel":"Set","closeLabel":"Close","setButtonType":"button-positive","closeButtonType":"button-stable"}` to be a date

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [January 20, 2016, 5:12am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/68 "2016-01-20T05:12:26Z")

</div>

What is the error here?

---

<div class="post-metadata">

**Author:** ![losewin](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@losewin](https://forum.ionicframework.com/u/losewin)\
**Post date:** [January 20, 2016, 6:08am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/69 "2016-01-20T06:08:38Z")

</div>

I followed this sample code

`$scope.temp.newSchedule = { local: true, status: 'add', start_at: { inputEpochTime: ((new Date()).getHours() * 60 * 60), //Optional step: 15, //Optional format: 12, //Optional titleLabel: '12-hour Format', //Optional setLabel: 'Set', //Optional closeLabel: 'Close', //Optional setButtonType: 'button-positive', //Optional closeButtonType: 'button-stable', //Optional callback: function (val) { //Mandatory // timePickerCallback(val); } } };`

Also the template

`<ionic-timepicker input-obj="timePickerObject"> <button class="button button-block button-positive overflowShow"> <standard-time-meridian etime='timePickerObject.inputEpochTime'></standard-time-meridian> </button> </ionic-timepicker>`

when I run my code that console came out… I dont know why… I used the latest version 😄

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [January 20, 2016, 6:27am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/70 "2016-01-20T06:27:28Z")

</div>

This is the object and the template that you are using. This is not the error. Could you please cross check the instructions i mentioned at the repo. Also if you find any other error on the console, you can paste it here.

---

<div class="post-metadata">

**Author:** ![losewin](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@losewin](https://forum.ionicframework.com/u/losewin)\
**Post date:** [January 20, 2016, 6:36am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/71 "2016-01-20T06:36:15Z")

</div>

I still do have the same error…

`<ionic-timepicker input-obj="temp.newSchedule"> <button class="button button-block button-positive overflowShow"> <standard-time-meridian etime='temp.newSchedule.start_at.inputEpochTime'></standard-time-meridian> </button> </ionic-timepicker>`

---

<div class="post-metadata">

**Author:** ![mi6crazyheart](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mi6crazyheart/32/92178_2.png) [@mi6crazyheart](https://forum.ionicframework.com/u/mi6crazyheart)\
**Post date:** [January 20, 2016, 12:11pm UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/72 "2016-01-20T12:11:18Z")

</div>

Hi,  
I follow the instructions are given in ripe ([https://github.com/rajeshwarpatlolla/ionic-timepicker](https://github.com/rajeshwarpatlolla/ionic-timepicker)). The issue I’m getting is **Current Time** is not visible above BUTTON. But, on click on button Timepicker is coming.

Don’t know what’s the issue. I’m also not getting any error inside my browser’s console.

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [January 20, 2016, 3:10pm UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/73 "2016-01-20T15:10:15Z")

</div>

You should have the variable in your controller to which you are assigning the time. Please check the demo.

---

<div class="post-metadata">

**Author:** ![mi6crazyheart](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mi6crazyheart/32/92178_2.png) [@mi6crazyheart](https://forum.ionicframework.com/u/mi6crazyheart)\
**Post date:** [January 21, 2016, 2:28am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/74 "2016-01-21T02:28:24Z")

</div>

Thanks for the quick reply. Here is the piece of code from my Controller file & View files.

CONTROLLER file Code

```
// Code for Timepicker
function timePickerCallback(val) {
    if (typeof (val) === 'undefined') {
        console.log('Time not selected');
    } else {
        $scope.timePickerObject.inputEpochTime = val;
        var selectedTime = new Date(val * 1000);
        console.log('Selected epoch is : ', val, 'and the time is ', selectedTime.getUTCHours(), ':', selectedTime.getUTCMinutes(), 'in UTC');
    }
}

$scope.timePickerObject = {
    inputEpochTime: ((new Date()).getHours() * 60 * 60), //Optional
    step: 15, //Optional
    format: 12, //Optional
    titleLabel: '12-hour Format', //Optional
    setLabel: 'Set', //Optional
    closeLabel: 'Close', //Optional
    setButtonType: 'button-positive', //Optional
    closeButtonType: 'button-stable', //Optional
    callback: function (val) { //Mandatory
        timePickerCallback(val);
    }
};

```

VIEW file code

```
<ionic-timepicker input-obj="timePickerObject">
    <button class="button icon-left ion-clock overflowShow">
        <standard-time-meridian etime='timePickerObject.inputEpochTime'></standard-time-meridian>
    </button>
</ionic-timepicker>

```

Is there anything I’m missing from this code ?

---

<div class="post-metadata">

**Author:** ![losewin](https://avatars.discourse-cdn.com/v4/letter/l/b77776/32.png) [@losewin](https://forum.ionicframework.com/u/losewin)\
**Post date:** [January 21, 2016, 2:39am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/75 "2016-01-21T02:39:45Z")

</div>

Thank you… its on my mistake… `((new Date()).getHours() * 60 * 60)` i change it to `12600` in order to be a valid date… 😄

---

<div class="post-metadata">

**Author:** ![mi6crazyheart](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mi6crazyheart/32/92178_2.png) [@mi6crazyheart](https://forum.ionicframework.com/u/mi6crazyheart)\
**Post date:** [January 22, 2016, 2:45am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/77 "2016-01-22T02:45:36Z")

</div>

@rajeshwarpatlolla Hey, finally I shorted out the thing. I didn’t add those directive (standardTimeMeridian) in my app.js file. After adding that one, now Date is showing on the button.

By the way, it’s also nowhere mentioned in your ‘How to use’ section of GitHub repo. It’ll be a really great help if you add this piece of information also at there.

Anyway, thanks for this great work.

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [January 22, 2016, 4:00am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/78 "2016-01-22T04:00:31Z")

</div>

Thanks for your suggestion. 😀

---

<div class="post-metadata">

**Author:** ![ionicnoob](https://avatars.discourse-cdn.com/v4/letter/i/f17d59/32.png) [@ionicnoob](https://forum.ionicframework.com/u/ionicnoob)\
**Post date:** [January 31, 2016, 8:12am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/79 "2016-01-31T08:12:18Z")

</div>

Hi,  
I am pretty new to ionic and I am trying to implement your time picker. However, I realise that the displayed time picker doesn’t correspond to my local timing when I perform a filter.

For example, on your time picker I selected 3:00PM.

In my code, I performed console.log($filter(‘date’)(selectedTime, ‘HH:mm a’));  
and it seems to print out 23:00 instead. My timezone is GMT +8.

Is there any way such that the time picker would display my actual time zone timing?

Thank you for your help and I really hope to hear from you soon.

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [January 31, 2016, 6:20pm UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/80 "2016-01-31T18:20:01Z")

</div>

This time picker doesn’t deal with the local time zone. Whenever you select some time all it will perform is giving the time in epoch to the user, so that you can do any custom manipulations.

---

<div class="post-metadata">

**Author:** ![acejohn](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@acejohn](https://forum.ionicframework.com/u/acejohn)\
**Post date:** [February 4, 2016, 7:47am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/81 "2016-02-04T07:47:53Z")

</div>

Hi I tried your timepicker but there is no date in my console.log even in my html. What was my error? I have already the directives to main app.

---

<div class="post-metadata">

**Author:** ![rajeshwarpatlolla](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajeshwarpatlolla/32/70759_2.png) [@rajeshwarpatlolla](https://forum.ionicframework.com/u/rajeshwarpatlolla)\
**Post date:** [February 4, 2016, 8:20am UTC](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409/82 "2016-02-04T08:20:15Z")

</div>

Kindly please follow the instructions as mentioned in the github repo. Surely you will get it.

[Previous page](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409.md?page=3)

[Next page](https://forum.ionicframework.com/t/a-time-picker-for-ionic-framework-applications/13409.md?page=5)
