# wxDatePickerCtrl

**URL:** <https://www.ruby-forum.com/t/wxdatepickerctrl/154993>\
**Category:** wxRuby\
**Created:** [December 5, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993 "2008-12-05T22:54:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [December 5, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/1 "2008-12-05T22:54:37Z")

</div>

Ciao Alex,

is there any chance to have wxDatePickerCtrl support in wxRuby?

cheers,

bio.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [December 5, 2008, 11:02pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/2 "2008-12-05T23:02:14Z")

</div>

Fabio P. wrote:

> is there any chance to have wxDatePickerCtrl support in wxRuby?

Yeah, I can have a look at it; please file a Feature Request to track  
it.

I’ve tried adding the class before and ran into problems. But classes  
that were previously difficult can often be solved now as the wrappings  
generally have improved.

alex

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [December 5, 2008, 11:39pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/3 "2008-12-05T23:39:12Z")

</div>

> Yeah, I can have a look at it; please file a Feature Request to track it.

done!

thank you.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [February 16, 2009, 8:07pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/4 "2009-02-16T20:07:10Z")

</div>

May I ask if the wxDatePickerCtrl is now supported in the latest wxRuby?

If so how would you obtain a value from it? Many thanks 🙂

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [February 17, 2009, 9:57am UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/5 "2009-02-17T09:57:34Z")

</div>

Hi,

2009/2/16 Rooby N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> May I ask if the wxDatePickerCtrl is now supported in the latest wxRuby?

Yes it is supported.

> If so how would you obtain a value from it? Many thanks 🙂

This is documented at  
[http://wxruby.rubyforge.org/doc/datepickerctrl.html](http://wxruby.rubyforge.org/doc/datepickerctrl.html)

Chauk-Mean.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [February 17, 2009, 12:56pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/6 "2009-02-17T12:56:44Z")

</div>

> Yes it is supported.

Thank you for that, great news.

> This is documented at  
> [http://wxruby.rubyforge.org/doc/datepickerctrl.html](http://wxruby.rubyforge.org/doc/datepickerctrl.html)

Sorry I should have mentioned that I have already looked at this page  
and have tried some of the methods but without success, hence my asking  
about the widget being supported. Currently, id\_datectrl\_from.get\_value  
produces the following:

#SWIG::TYPE\_p\_wxDateTime:0x7f0fdf7e70c0

Is this what you would expect, and if so, how would you obtain a date  
value from it?

One thing mentioned on this page is “It is only available if  
USE\_DATEPICKCTRL is set to $1$” - how would I go about checking or  
implementing this?

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [February 17, 2009, 2:45pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/7 "2009-02-17T14:45:09Z")

</div>

> No, it’s a bug. Thanks for the report.

Glad to be of help!

> It should be easy to fix - the SWIG typemap for wxDateTime that’s  
> applied to wxDateTime& needs to be applied to wxDateTime. For some  
> reason wxWidgets has one class return an C++ object and the other a C++  
> reference.

Er, yes, that’s just what I thought! Anyway I hope it’s easy to fix and  
I look forward to being able to use the datepicker shortly.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [February 17, 2009, 2:17pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/8 "2009-02-17T14:17:39Z")

</div>

Rooby N. wrote:

> Sorry I should have mentioned that I have already looked at this page  
> and have tried some of the methods but without success, hence my asking  
> about the widget being supported. Currently, id\_datectrl\_from.get\_value  
> produces the following:
> 
> #SWIG::TYPE\_p\_wxDateTime:0x7f0fdf7e70c0
> 
> Is this what you would expect, and if so, how would you obtain a date  
> value from it?

No, it’s a bug. Thanks for the report. It should return a ruby Time  
object (as other classes eg CalendarCtrl do). Ufnortunately you won’t be  
able to do anything useful with the current return value.

It should be easy to fix - the SWIG typemap for wxDateTime that’s  
applied to wxDateTime& needs to be applied to wxDateTime. For some  
reason wxWidgets has one class return an C++ object and the other a C++  
reference.

> One thing mentioned on this page is “It is only available if  
> USE\_DATEPICKCTRL is set to $1$” - how would I go about checking or  
> implementing this?

Ignore this.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [March 6, 2009, 2:16pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/9 "2009-03-06T14:16:26Z")

</div>

Does anyone know if there is any way to show the date in a  
wxDatePickerCtrl in UK date format (dd/mm/yyyy) rather than the default  
mm/dd/yyyy?

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [March 6, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/10 "2009-03-06T16:18:23Z")

</div>

Rooby N. wrote:

> Does anyone know if there is any way to show the date in a  
> wxDatePickerCtrl in UK date format (dd/mm/yyyy) rather than the default  
> mm/dd/yyyy?

Try adding this somewhere early in your App.run / App#on\_init code:

Wx::App.run do  
Wx::Locale.locale = ‘en\_GB’  
…  
end

a

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [March 6, 2009, 4:26pm UTC](https://www.ruby-forum.com/t/wxdatepickerctrl/154993/11 "2009-03-06T16:26:32Z")

</div>

Success. Many thanks for your help, and also for recently sorting out  
the bug with the Date Picker.
