Home > .NET TimePicker > Yet Another TimePicker Update – DisplaySeconds

Yet Another TimePicker Update – DisplaySeconds

I had several people tell me they would find it useful if there were a way to hide the seconds of the datepicker. For this reason, I created the DisplaySeconds boolean property. It’s also included in the TimePicker documentation.

Categories: .NET TimePicker Tags:
  1. Dave Hunt
    May 12th, 2009 at 02:20 | #1

    Hi Mike,

    Any chance you will be adding a .SelectedTime method? Several of the other TimePickers have this for assignment or comparison.

    thanks!
    Dave

  2. June 6th, 2009 at 17:44 | #2

    Hello I’m developing an application for my current company and I would really like to use yopur timepicker
    but it doesn’t works for asp.net 2.0 when I try to add it it says cannot load System.Web.Extensions and I tryed
    to add the extension manually and it doesn’t exists in framework 2.0 isn’t the component compatible with 2.0 like it says in the page??

    And if there’s an older version of it that you have can you please send it to me or post it somewhere so I can download it??

    Best Regards

  3. Michael Bell
    June 10th, 2009 at 14:48 | #3

    Dave Hunt :

    Hi Mike,

    Any chance you will be adding a .SelectedTime method? Several of the other TimePickers have this for assignment or comparison.

    thanks!
    Dave

    The “Date” property is actually what contains the time… the time and the date. I might have to rename this property though…

  4. Michael Bell
    June 10th, 2009 at 14:49 | #4

    Ivan Rodriguez :

    Hello I’m developing an application for my current company and I would really like to use yopur timepicker
    but it doesn’t works for asp.net 2.0 when I try to add it it says cannot load System.Web.Extensions and I tryed
    to add the extension manually and it doesn’t exists in framework 2.0 isn’t the component compatible with 2.0 like it says in the page??

    And if there’s an older version of it that you have can you please send it to me or post it somewhere so I can download it??

    Best Regards

    You can download an older code base from the codeplex project, which is located at http://TimePicker.Codeplex.com

  5. Wezlie
    June 17th, 2009 at 00:18 | #5

    Hello Michael,

    I’m glad that I found your blog because I need to use a date picker in our ASP.net appplication. I already downloaded the TimePicker.dll but dont know how to use it. Please help how can use the .dll. I am a beginner programmer.

    Please Mike help me

    Thanks,
    Wezlie

  6. Wezlie
    June 17th, 2009 at 00:41 | #6

    Dear Mike

    I tried this step first:

    Add this in my aspx page but I saw an error message saying ‘unrecognize tag prefix’

    Please…

    Thanks,
    Wezlie

  7. Wezlie
    June 17th, 2009 at 00:42 | #7

    I mean added this

    Thanks again,
    Wezlie

  8. Wezlie
    June 17th, 2009 at 00:42 | #8

  9. Wezlie
    June 17th, 2009 at 00:43 | #9

    I mean this one MKB:timeselector id=’TimeSelector1″ runat

  10. Wezlie
    June 17th, 2009 at 00:45 | #10

    And then this:

    Imports System.Object
    Imports MKB.TimePicker
    Imports MKB.TimePicker.TimeSelectorAvailabilityValidator
    Imports MKB.TimePicker.ButtonSettings

  11. Wezlie
    June 17th, 2009 at 02:42 | #11

    Dear Mike
    And also when I include this code below in the General Declarations
    Imports MKB.TimePicker.TimeSelector

    i saw this error message
    ‘Indirect reference is being made to assembly System.Web.Extensions version 3.5.0.0
    whicj contains MKB.TimePicker.TimeSelector…To use MKB.TimePicker.TimeSelector
    ….you must replace the reference to System.Web.Extensions version with version or higher3.5.0.0′

    Thanks,
    Wezlie

  12. Frank
    July 15th, 2009 at 05:40 | #12

    Dear Mike,

    at first: Great Control! I want to use it in an application for my company but I need a little help.

    If got several TimePicker-Controls on one site. It works fine, if the user clicks on one arrow-key, the hour selects and increment.Now, if you click on the arrow keys of another control the time/hour is not selected automatic and the time increment on the last selected control, not on the current one. Is there any solution for this problem.

    Sorry for my bad english, I hope you understand what i mean. You can try this on your own demo-site: http://www.michaelkbell.com/TimePicker/ There occurs the same problem.

    Thank you

    Frank

  13. JD
    September 17th, 2009 at 14:22 | #13

    Anyone else have this problem?

    Whenever I try to parse the time, it forces the time into PM or AM regardless of its real value. If I have SelectedTimeFormat=”TwentyFour” on, it makes everything PM regardless.

    So I selected 05:00:00 which should return 9/17/2009 5:00:00 AM

    DateTime testB = DateTime.Parse(TimeSelector1.Date.ToShortTimeString());

    Instead I get 9/17/2009 5:00:00 PM

    Any ideas?

  14. JD
    September 17th, 2009 at 14:28 | #14

    @JD
    also tried these, but returned the same results..

    DateTime testB = DateTime.Parse(TimeSelector1.Date.ToString());

    DateTime test = DateTime.Parse(CalendarUpdate.SelectedDate.ToShortDateString() + ” ” + TimeSelector1.Hour + “:” + TimeSelector1.Minute + “:00″);

  15. MAQSOOD
    September 28th, 2009 at 00:26 | #15

    Hi Mike
    Which version of AJAX we need to use this control as I am getting the following error and dont know what to do???

    Assembly ‘TimePicker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d25e9f59e49c4d2f’ uses ‘System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ which has a higher version than referenced assembly ‘System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′

  16. bob smith
    September 30th, 2009 at 08:46 | #16

    Hi, I am trying to use your control within an ajax updatepanel. When I attempt to change the time when I run the form, I get the following error:

    “Microsoft JScript runtime error: Object Expected”

    Do you have a fix for this error?

    Thanks,
    bob

  17. bob smith
    September 30th, 2009 at 10:18 | #17

    @bob smith
    I fixed my own problem! Just add a dummy hidden TimeSelector outside of the formview (but inside the same updatepanel) and set it to invisible:

  18. MAQSOOD
    September 30th, 2009 at 20:28 | #18

    Hi Mike
    I have solved my above problem.
    Now there is another problem with this control. When I set SelectedTimeFormat to TwentyFour and I set hour that is > 12, it adds 12 hour in Hour property and that gives me wrong Hour. Can you check it for me

    Thanks

  19. hi mike
    October 12th, 2009 at 04:39 | #19

    hi mike,
    i tried to use your datetime picker.and i got a little issue when i was trying to use it in twenty four hour format.once i enter 1.30 it will comes as 13 in hours field.this happens when the client computer’s time is in PM.(as i guess)

    i feel it’good to have a look on that issue.please !!!

  20. Stephen Mew
    October 13th, 2009 at 20:11 | #20

    Hi Michael,
    Great control but am having an issue with it on a Dynamic Data Website.
    It was working great in normal webforms but something isn’t happy in a Dynamic context.

    I have added the control to a FieldTemplate and in Edit mode no matter what I do I cannot edit the time. The arrows dont change anything. Likewsise manually placing the cursor on hours or minutes and trying to increment / decrement by up/down arrows doesn;t do anything either…

    Any ideas ?

    Regards

    Steve Mew

  21. Michael Bell
    October 14th, 2009 at 08:38 | #21

    Sorry I’ve been lagging in the responses guys. Kind of busy these days. You can always grab the source from http://timepicker.codeplex.com and extend on or debug. I’d be happy to republish code if you find bugs/fixes. Sorry that I’m unableto commit time to this project right now…

  22. Aaron Xuereb
    November 2nd, 2009 at 05:22 | #22

    Hi Michael,

    I can’t manage to change the font color of the timepicker control. I tried using both stylesheets and the property of the control. No success. Can you please help me?

    thanks
    Aaron

  23. Nick K.
    November 23rd, 2009 at 16:51 | #23

    FYI – I tried using the lastest download of this library but it references a library, GVSVC.DLL that I can NOT find on my windows installation (Vista 64, Server 2003).

  24. Ilia Lukianov
    December 8th, 2009 at 06:00 | #24

    Hi!
    Well I probably fix bug with TwentyFour mode. How can update the source code for TimePicker?

  25. Jean
    January 8th, 2010 at 09:59 | #25

    Thanks Mike! I really like your timepicker. Its easy to use and priced right :)

    I was having the same problem as Frank (focus was not changing between multiple instances of timepickers), so I took a look at the source code on codeplex. I was able to get the focus to change by making a small change in the javascript function ensureFocus – just need to update the global variable lastFocusCtrl.

    function ensureFocus(c)
    {
    var controlSetPrefix = c.id.replace(‘_imgUp’, ”);
    controlSetPrefix = controlSetPrefix.replace(‘_imgDown’, ”);

    if (lastFocusCtrl == null) // This should only happen once, max
    {
    lastFocusCtrl = document.getElementById(controlSetPrefix + ‘_txtHour’);
    }
    else
    {
    if (lastFocusCtrl.id.indexOf(controlSetPrefix) != 0)
    {
    var elem = document.getElementById(controlSetPrefix + ‘_txtHour’)
    if (null != elem)
    {
    elem.focus();
    lastFocusCtrl = elem;
    }
    }
    }
    }

    Thanks again!

  26. January 15th, 2010 at 09:25 | #26

    Hi Mike,
    Did you fixed the problem JD mentioned here.(Comment no 13, 14). I have the same problem. If we set SelectedTimeFormat=”TwentyFour” then if we choose 5:00 it returns only PM as 17:00. Could you pls fix this problem and update the DLL?

    Thanks again!.

  27. January 15th, 2010 at 09:29 | #27

    @Ilia Lukianov
    Hi Ilia, could u please send the source code for fix the SelectedTimeFormat=”TwentyFour”?

  28. Frank
    January 20th, 2010 at 16:19 | #28

    Thank you Jean for posting your solution.
    works great!

  29. chris
    February 1st, 2010 at 15:52 | #29

    Hi,
    relating to the TwentyFour bug – 09:00 always getting 21:00, 10:00 always
    getting 22:00 and so on…
    don’t know if that’s really a good solution, but it worked for me:

    IMHO there was just a little piece of code missing in the date property:

    ///
    /// DateTime value. Defaults to current day if not set. Otherwise, maintains a value of the date assigned plus time shown.
    ///
    [Browsable(true)]
    public DateTime Date
    {
    get
    {
    if (ViewState["Date"] == null)
    return DateTime.MinValue;
    else
    {
    if (SelectedTimeFormat == TimeFormat.Twelve)
    {
    ViewState["Date"] = Convert.ToDateTime(ViewState["Date"]).ToShortDateString() + ” ” + Hour.ToString() + “:” + Minute.ToString() + “:” + Second.ToString() + ” ” + AmPm.ToString();
    }
    else
    {
    ViewState["Date"] = Convert.ToDateTime((Convert.ToDateTime(ViewState["Date"]).ToShortDateString() + ” ” + Hour.ToString() + “:” + Minute.ToString() + “:” + Second.ToString() + ” “), System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat);
    }
    return Convert.ToDateTime(ViewState["Date"]);
    }
    }
    set
    {
    ViewState["Date"] = value;
    SetTime(value);
    }
    }

    maybe someone can benefit from

  30. Jessy
    February 8th, 2010 at 17:26 | #30

    @chris
    I tied adding this to my solution but it’s still not working. Can you please provide step by step instructions on where and how to add his code?

    Thank you SO much in advance!

  31. cdw
    February 8th, 2010 at 20:40 | #31

    Has anyone successfully built a patched version that corrects the 24 Hour problem? Would you like to make the source and/or DLL available?

  32. Louie
    March 23rd, 2010 at 21:49 | #32

    No more support for this timepicker? I also have the twentyfour hour problem, it alsways display 10am as 22:00. I’ll just create my own and post it later.

  33. Mark
    March 30th, 2010 at 11:14 | #33

    From what I found and seems to have fixed it for me, is the fact that if the control is in ‘24′ hour mode, the ampm attribute is not created, therefore when LoadPostData() executes, since it’s not found, it defaults to PM. I added the following change (locate ’string sAmPm’ in the LoadPostData() function) and has been working fine so far.

    // If missing, should be in 24 hour
    string sAmPm = values[this.UniqueID + "_txtAmPm"];
    if (!String.IsNullOrEmpty(sAmPm))
    {
    AmPmSpec tAmPm = (values[this.UniqueID + "_txtAmPm"] == “AM”) ? AmPmSpec.AM : AmPmSpec.PM;
    if (tAmPm != AmPm)
    {
    AmPm = tAmPm;
    hasAmPmChange = true;
    }
    }
    else
    {
    if (int.Parse(sHour) > 11)
    {
    AmPm = AmPmSpec.PM;
    }
    else
    {
    AmPm = AmPmSpec.AM;
    }
    }

  34. Terry
    April 7th, 2010 at 04:56 | #34

    How to set all zero for hour, minute and second? Example: 00:00:00

    I am using SelectedTimeFormat=”TwentyFour”.

    Thanks.

  35. May 24th, 2010 at 14:21 | #35

    @Jean
    I have implemented your fix. FOcus issues are hopefully resolved when using more than one instance in a page!

  36. May 24th, 2010 at 14:30 | #36

    I have implemented your fix and placed it here and on CodePlex.

    chris :
    Hi,
    relating to the TwentyFour bug – 09:00 always getting 21:00, 10:00 always
    getting 22:00 and so on…
    don’t know if that’s really a good solution, but it worked for me:
    IMHO there was just a little piece of code missing in the date property:
    ///
    /// DateTime value. Defaults to current day if not set. Otherwise, maintains a value of the date assigned plus time shown.
    ///
    [Browsable(true)]
    public DateTime Date
    {
    get
    {
    if (ViewState["Date"] == null)
    return DateTime.MinValue;
    else
    {
    if (SelectedTimeFormat == TimeFormat.Twelve)
    {
    ViewState["Date"] = Convert.ToDateTime(ViewState["Date"]).ToShortDateString() + ” ” + Hour.ToString() + “:” + Minute.ToString() + “:” + Second.ToString() + ” ” + AmPm.ToString();
    }
    else
    {
    ViewState["Date"] = Convert.ToDateTime((Convert.ToDateTime(ViewState["Date"]).ToShortDateString() + ” ” + Hour.ToString() + “:” + Minute.ToString() + “:” + Second.ToString() + ” “), System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat);
    }
    return Convert.ToDateTime(ViewState["Date"]);
    }
    }
    set
    {
    ViewState["Date"] = value;
    SetTime(value);
    }
    }
    maybe someone can benefit from

  1. No trackbacks yet.