Modify human_time_diff() to shorten “days” to “d” and “hours” to “h” etc

I’m using the function echo time_ago() that displays the time like this: 5 days ago what’s the best way to change it to 5d ago ? My research led me to human_time_diff() function located in “formatting.php” So I have tried directly editing the function located at /wp-includes/formatting.php but when I change “hours” to “h” and … Read more

How to parse/format dates with LocalDateTime? (Java 8)

Java 8 added a new java.time API for working with dates and times (JSR 310). I have date and time as string (e.g. “2014-04-08 12:30”). How can I obtain a LocalDateTime instance from the given string? After I finished working with the LocalDateTime object: How can I then convert the LocalDateTime instance back to a … Read more

In Ruby on Rails, what’s the difference between DateTime, Timestamp, Time and Date?

In my experience, getting dates/times right when programming is always fraught with danger and difficulity. Ruby and Rails have always eluded me on this one, if only due to the overwhelming number of options; I never have any idea which I should pick. When I’m using Rails and looking at ActiveRecord datatypes I can find … Read more