I have a Date which I'd like to format into text that is usable by a text-to-speech engine. I am currently doing it by hand using various SimpleDateFormats.
Examples of what should result from formatting:
Any thoughts? Thanks.
If you are willing to lose precision, there are examples of code that reports the time as "quarter to one" or "five past ten", but the examples I can find all do what you are already doing and use if/then/else to check for all the special cases.
Take a look at http://sourceforge.net/projects/fuzzytime/ for a Python script that does this, or search for "fuzzy time" to get several other examples.
Otherwise, I think you are already on the right track as long as you catch all the edge cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With