I know it is possible to use tzupdater.jar to update a timezone database in the JVM, and I've no doubt that changing daylight savings times (by editing rules in the IANA database) is a fairly easy thing to do.
However, and regardless of whether or not this is a good thing to do in practice, I would like to know if it is possible to omit entire continents or just some / combinations from tzdb.dat.
Can the IANA distribution be edited to do this and, if so, how ?
Thanks
We are building a solution to optimize crew, we start working in opta with time window but i don't know the format of time.
What is actually the format of time in optaPlanner (Service time and due start time) and how i can Implement time conversion between java and C#??
It depends on your OptaPlanner implementation of the use case. Normally, you'd use java.time.* classes on the Java/DRL side to accurately deal with timezones etc in your constraints.
As for bridging Java and C#, just connect through a REST service and use the standard ISO format (yyyy-mm-dd hh:mm:ss) in the JSON or XML input/output.
I am developing a calendar application that needs to draw rectangles whose heights and vertical position are based on the start date of the event they represent. I am trying to test the layout system against dates and time zones with daylight saving. Specifically I want to account for the fact that in some regions daylight saving can remove/add an hour to the day.
Currently I'm stumped on how to write unit tests against daylight saving time.
See the NSTimeZone class reference. It has a handy BOOL property called -daylightSavingTime and related friends you may find useful. You can create a date with a specific time zone / date combination to get what you need and feed that instead of the system-provided time.
I'm not sure there's a way to change the system time (even in the simulator) programmatically, however. I haven't attempted anything like this but perhaps a creative use of some preprocessor macros and/or environment variables could let you toggle between test states.
An NSDate object represents an absolute date and time, e.g. September 4, 2012, 10:00PM CDT. While this works fine when an event did indeed happen at a certain moment in time, it's much more of a hassle to work with NSDate when you're dealing with something that's a recurring event. For example, I'm currently working on an app that stores the hours of operation of businesses. Most businesses have a weekly schedule, which means that I would like to store the times per weekday, regardless of the date.
There are several solutions: create an extra entity (I'm working with Core Data), Hours, with attributes weekday, hour, and minute and figure it out that way. This could work for simple displaying, but I'm also going to add a "status" (such as "open until x", "closing in y minutes", or "will open at z"). This means I'll either have to create NSDate objects to do the comparing, or I take the weekday, hour, and minute properties of the current NSDate.
Another option would be to store two NSDates per business (open and close), and ignore the actual date and only use the weekday, hour, and minute properties. I've tried this, but to be able to compare dates, I'd still have to manipulate NSDate objects.
These are the solutions I've come up with. Both require a lot of math and involve a bunch of ifs, buts, and maybes. It would be really easy to simply have some sort of "NSTime" object with which I can do everything, but that doesn't (seem to) exist.
Has anyone else had the same problems and found a better solution?
I think you're better off creating your own abstractions. That will better fit with the problem you're trying to solve. Some pointers for help:
Fowler's recurring events for calendars (pdf) patterns.
ice_cube: A ruby library for recurring events (for the design idea).
It would be really easy to simply have some sort of "NSTime" object
with which I can do everything, but that doesn't (seem to) exist.
One option is to use NSDateComponents, in which you can store just the parts of a date that you're interested in, like hours, minutes, and seconds.
Since you really just want to store a time of day, another option is to create your own Time class. NSDate stores moments in time as a single number: the number of seconds since a fixed time, the epoch. Your Time class could do nearly the same thing, except that it would use midnight as the reference point. You may run into problems, though, if you're not able to indicate times beyond the end of the day. For example, if a restaurant stays open until 2am, you might want to be able to represent that relative to the day when the restaurant opened. Perhaps a better option is to have your Time class use NSDate internally, but always with a fixed starting date.
I just HATE the UIDate and Time Picker that Apple supplies. Do you know of any other library that creates an equivalent UI element for picking time and date, that can be better customized at least? I'd hate to rediscover the weel.
Thanks!
Just for any others wondering about my conclusions...
I think it would look better to use a calendar to pick the date and keep a picker for the time so far.
For calendar there is a good implementation here:
https://github.com/klazuka/Kal