Questions tagged [prettytime]

PrettyTime is an OpenSource time formatting library for Java. Completely customizable, it creates human readable, relative timestamps like those seen on Digg, Twitter, and Facebook.

10 questions
3
votes
2 answers

Parsing ill-formated date-time string in Java

In one sentence: Should I be able to parse "04 Dec 2014 pm 1:58" by PrettyTime? Descriptive: I am in need to parse & get proper date format from some ill formatted date-time string. e.g. "04 Dec 2014 pm 1:58". When I do parse this example string,…
Amit K. Saha
  • 5,871
  • 2
  • 27
  • 35
2
votes
1 answer

How to describe duration in Android?

I'm writing small app and I need to write duration of sport event in i18n. Im using PrettyTime library for date, but when I attempt to use DateUtils or PrettyTime, I have issues.. For example I want to say that duration is 2 minutes. I need some way…
kurd
  • 467
  • 1
  • 10
  • 18
2
votes
1 answer

Using the pretty time library to show a time in a human readable format in JSF

I happened to use pretty time 1.0.6 to display an interval between two points in time in a human readable format. There is an in-built JSF converter, com.ocpsoft.pretty.time.web.jsf.PrettyTimeConverter but it supports only java.util.Date objects. I…
Tiny
  • 27,221
  • 105
  • 339
  • 599
0
votes
1 answer

Output "from Now" string in Kotlin using UTC timezone

I'm trying to write a Kotlin function which replicates the behaviour of fromNow in the moment library. I have the following code: fun formatDuration(dateTime: String): String { try { val parsedDateTime = Instant.parse(dateTime) …
Alk
  • 5,215
  • 8
  • 47
  • 116
0
votes
2 answers

Is there any PrettyTime function in Swift

In my android app I use the following code to get a string that converts a date to readable sentence (se below image). Is there any way to do this is swift 4.2? private String getDate(String d) { String datemobile = ""; try { …
user1163234
  • 2,407
  • 6
  • 35
  • 63
0
votes
3 answers

how to convert time in miliSec from UTc to local time in miliSec

I'm getting time from a server in milliseconds and trying to convert it in local time. I want to pass it to my PrettyTime Using Java like this: PrettyTime p = new PrettyTime(); long millisec = 1522034539973; String time = p.format(new…
Constantin N.
  • 2,739
  • 2
  • 16
  • 27
0
votes
1 answer

Format time with PrettyTime library

Processing news RSS feeds and trying to display them with the time elapsed (like 2 min ago, 1 month ago). I'm using PrettyTime library for Android. It works fine for such dates formats Thu, 04 Jan 2018 11:00:16 +0000. However,…
PLab
  • 175
  • 1
  • 1
  • 9
0
votes
1 answer

Java/Grails - PrettyTime NLP Possible to split non date part?

I am using PrettyTime NLP to find dates from a list. Example ABC High School March 5, 2016 XYZ High School 08/20/2016 Gym When I parse using PrettyTimeNLP, it gives me a list of dates in this format. Sat Aug 20 10:05:27 EDT 2016 My question is if…
monty_bean
  • 494
  • 5
  • 25
0
votes
2 answers

Grails and Angular: GSP plugin tag inside ng-repeat loop

I'm working in a Grails project that uses Angular. I use a plugin called PrettyPrint in order to have "twitter like" time (i.e. formatting dates like 'moments ago'). I want to use the plugin inside a ng-repeat loop.
Agorreca
  • 684
  • 16
  • 31
0
votes
2 answers

Converting timestamp from parse.com in java

I'm getting my object's createdAt timestamp back from parse.com as 2014-08-01T01:17:56.751Z. I have a class that converts it to relative time. public static String timeAgo(String time){ PrettyTime mPtime = new PrettyTime(); long timeAgo =…
Mr Smith
  • 331
  • 1
  • 4
  • 14