Comprehensive (Intelligent) Date library - java

I'm looking for a complete Date management library in java that would allow me to understand strings like :
Tomorrow at noon => 2011-10-20 12:00
Today at 4pm => 2011-10-20 16:00
etc...
But it would be perfect if this lib would also be Internationalized. I plan to use it in many languages, and "just" english wouldn't be enough.
I already found http://www.datejs.com/ as a possibility, but it's for Javascript (client)'s side. I'm looking for something in Server side.
Thanks for your help!

PrettyTime is what you need

You could easily build that yourself with e.g. Joda Time.

An similar question was at PHP's strtotime() in Java and here's a good answer. #dfa did an object that do exactly what I'm looking for, you can find the link here

Related

Ruby Timezone String to java Timezone

I have a ruby process that writes to DB timezones according to ruby TimeZone Class so at the table I get strings such as:
"Pacific Time (US & Canada)"
"Eastern Time (US & Canada)"
"UTC"
"Paris"
and so on ..
Is there a way (not hard coded map) to read those strings and convert them into java Timezone instance?
The authoritative source for Rails time zone names to standard TZDB/IANA time zone identifiers is the TimeZone.MAPPING constant in the Rails source code here. If you are able to access this mapping in your Rails code, then you don't need to hardcode anything.
If rather (as it appears in the question comments) that you need to do the translation in your Java code, then you'll have to parse this mapping from the Rails code into something usable in your Java code, and periodically check for changes. Thankfully, the Rails developers don't seem to change this list often.
I don't know of a Java library that already does this for you, but .NET developers can take advantage of my TimeZoneConverter library, which imports this mapping. If you want to write your own code for this, feel free to translate my LoadRailsMapping function from C# to Java.
See also my notes on Rails time zone names at the bottom of the timezone tag wiki.

Using what DatePicker in java8?

I want to make a user pick a date. After this, I want to convert it to a java.time.LocalDate without getting in trouble.
I would like to get something looking like this:
I know, this image is made from a JDatePicker. I read several tutorials about this, but it seems to be outdated or no longer supported – eclipse tells me it cannot import JDatePickerImpl (for example). (I tested that class by trying this tutorial (look for the answer by MadProgrammer)).
What do I search for? (I guess it already exists, I wonder if I had to implement it myself.)
How to use it? (Link for a good tutorial, for example)
setting date (using java.time.LocalDate)
getting date (using java.time.LocalDate)
I need to use "big" dates: I would like to make it work with at least 2000 years from now. For this purpose it's important to make the user able to type the year manually. (Instead of clicking up and down, but in the image it looks like this is possible.)
I am not sure if I understand all your specs well but at least I can share tutorial from Oracle docs which worked fine for me with Java8 (JavaFX) when I experimented with the date.
JavaFX Date Picker
Hope it helps.

How to convert a timezone to its NI Real Time Controller notation in Java?

This question was misleading and unanswerable as originally written, because it turns out the real timezone format was not System V, but a slightly different one used by National Instruments. I was reverse engineering the protocol and I should not have been so sure I knew what I was talking about.
Original Question:
I am working with a network protocol that sends timezone information in System V notation (ie. EST5EDT or MST7MDT), and I need to convert the current timezone into this format using Java. Is there good or fairly good way to do this?
The real answer (to the modified question) was found here where there is a table showing UTC offsets and their associated names for National Instruments Real Time Controllers. This can be used as an okay way/kind of bad to convert timezones. Sorry for the bad question.

What library can i use to parse a Schedule String in Java

I am currently writing a program in Java where I have to parse User Input like "every 4 hours" "every day 6:00" or something like that and turn that into an interval.
The only thing I found was the Google Docs for Cloud Cronjobs https://cloud.google.com/appengine/docs/java/configyaml/cron#Java_app_yaml_The_schedule_format
Can someone tell me about some library that could achieve this?
EDIT:
I found a ruby library that can do this: https://github.com/yb66/tickle
Is there any Java Implementation of it?
Try JChronic which is a java implementation of Ruby Chronic:
https://github.com/samtingleff/jchronic
This gives allows you to convert things like next tuesday into real dates.
My solution was to take some parts from Rubys Tickle and Chronic and write it myself.
If anyone ever needs this, feel free to contact me

Is there a way to sign my code or secure it?

I am a java beginner anyway, I have written this program that formats Military time that java returns to normal time, for example 1:01 PM instead of 13:01:00. To get to the point I ust created a blog a tumblr and I want to share this code and I know it sounds silly and sellfish but I want to learn to secure my code or stamp it somehow so people dont steal it?
Big question. It depends from the legal framework of your country.
Generally speaking you can start the long process to patent your system, but the simple code has not change (work around excluded) and it is quite expensive (for my patent we spent 12K€ more or less).
In Italy we have SIAE: we pay 120€ and we send a CD to an authority; the code will be protected for 5 years, but if a guy change the 20% of the original code .. it is another code.

Categories