Page 1 of 1
handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 7:18 pm
by HengeDK
how can you handle the cancel button in iphonePickDate dialog
if I press the cancel button I receive "10/10/70 :01.00" back
can I be sure that all users will receive this back ?
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 7:23 pm
by Klaus
We have a special iOS forum, please use this for all iOS related question (beginner or not).
Will move this post now (just like your previous one

)
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 7:29 pm
by HengeDK
will do
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 7:52 pm
by bn
Hi,
the documentation is a bit ambiguous on this:
at one place it says that the return value contains 0 if the user canceled, at another place that the return value is "cancel" if the user canceled.
So best would be if you test the result for "cancel" and also for "0" to catch a cancel event before converting to date && time.
I would expect that you get 01/01/70 :01:00
This is because I guess your computer is set to a time zone UTC +1, hence 01:00 instead of 00:00 which would show up if you would set your computer time zone to Greenwich Mean Time = UTC. This is not taking into account Daylight saving time.
Kind regards
Bernd
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 7:55 pm
by HengeDK
Hi Bernd
Thanks for your help
both "0" and "cancel" is a no go
any other ideas

Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 8:22 pm
by bn
I would make a field and put the result into the field. Then you would know what the result contains when you do different actions.
Kind regards
Bernd
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 8:35 pm
by HengeDK
Hi Bernd
thanks for your help !!
I did and I get 01/01/70 :01:00 every time I press cancel
My problem is I can't check for all countries with different timezones
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 9:04 pm
by bn
If you convert the result to seconds you get 0, which is the begin of the unix epoch. You don't have to worry about time zones. It will always be zero.
but beware: for the ipad you have to explicitly set the cancel/done option. Otherwise a click outside of the pickWheel without selection will return the current date/time.
Kind regards
Bernd
Re: handle cancel button iphonePickDate
Posted: Wed Oct 10, 2012 9:32 pm
by HengeDK
Hi Bernd
You are the man !!
thanks a lot !