You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ryan Kumsher (JIRA)" <ji...@apache.org> on 2017/08/07 21:24:00 UTC

[jira] [Commented] (LANG-350) New RandomDateUtils class in the lang.time package

    [ https://issues.apache.org/jira/browse/LANG-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16117329#comment-16117329 ] 

Ryan Kumsher commented on LANG-350:
-----------------------------------

In the meantime, while we wait for Lang 4.0, there is a [RandomDateUtils|https://github.com/RKumsher/utils/blob/master/src/main/java/com/github/rkumsher/date/RandomDateUtils.java] in my [utils project|https://github.com/RKumsher/utils] that people can use from the Maven Central Repository to generate random dates, times, instants, and durations from Java 8's [date and time API|https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html]

{code:java}
<dependency>
  <groupId>com.github.rkumsher</groupId>
  <artifactId>utils</artifactId>
  <version>1.0</version>
</dependency>
{code}

It also currently has utility classes to:
* Generate random collections
* Retrieve random entries from collections
* etc.

> New RandomDateUtils class in the lang.time package
> --------------------------------------------------
>
>                 Key: LANG-350
>                 URL: https://issues.apache.org/jira/browse/LANG-350
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.time.*
>    Affects Versions: 2.3
>            Reporter: Nathan Silberman
>            Priority: Minor
>         Attachments: RandomDateUtils.java, RandomDateUtilsTest.java
>
>
> A new RandomDateUtils class that would provide methods for returning random datetimes and random simple dates. Its functionality would include but not limited to the following: 
> /* 
>  * Random datetime after Janurary 1st, 1970
>  */
> public static Date randomDate();
> /* 
>  * A Random datetime after the given date
>  */
> public static Date randomDateAfter( Date date );
> /* 
>  * A Random datetime before the given date
>  */
> public static Date randomDateBefore( Date date );
> /* 
>  * Random datetime after this instant
>  */
> public static Date randomFutureDate();
> /* 
>  * Random datetime before this instant
>  */
> public static Date randomPastDate();
> /* 
>  * Random date (zeroed out time) after Janurary 1st, 1970
>  */
> public static Date randomSimpleDate();
> /* 
>  * A Random date (zeroed out time) after the given date
>  */
> public static Date randomSimpleDateAfter( Date date );
> /* 
>  * A Random date (zeroed out time) before the given date
>  */
> public static Date randomSimpleDateBefore( Date date );
> /* 
>  * Random date (zeroed out time) after this instant
>  */
> public static Date randomSimpleFutureDate();
> /* 
>  * Random date (zeroed out time) before this instant
>  */
> public static Date randomSimplePastDate();



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)