smart-date-generator

Demo project for Spring Boot

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

jp.spring-boot-reference
ArtifactId

ArtifactId

smart-date-generator
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

smart-date-generator
Demo project for Spring Boot
Project URL

Project URL

https://github.com/kcwebapply/smart-date-generator
Source Code Management

Source Code Management

https://github.com/kcwebapply/smart-date-generator

Download smart-date-generator

How to add to project

<!-- https://jarcasting.com/artifacts/jp.spring-boot-reference/smart-date-generator/ -->
<dependency>
    <groupId>jp.spring-boot-reference</groupId>
    <artifactId>smart-date-generator</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/jp.spring-boot-reference/smart-date-generator/
implementation 'jp.spring-boot-reference:smart-date-generator:1.0'
// https://jarcasting.com/artifacts/jp.spring-boot-reference/smart-date-generator/
implementation ("jp.spring-boot-reference:smart-date-generator:1.0")
'jp.spring-boot-reference:smart-date-generator:jar:1.0'
<dependency org="jp.spring-boot-reference" name="smart-date-generator" rev="1.0">
  <artifact name="smart-date-generator" type="jar" />
</dependency>
@Grapes(
@Grab(group='jp.spring-boot-reference', module='smart-date-generator', version='1.0')
)
libraryDependencies += "jp.spring-boot-reference" % "smart-date-generator" % "1.0"
[jp.spring-boot-reference/smart-date-generator "1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar 2.1.1.RELEASE

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.1.1.RELEASE

Project Modules

There are no modules declared in this project.

smart-date-generator

apache licensed Java Maven Central

https://search.maven.org/artifact/jp.spring-boot-reference/smart-date-generator/1.0/jar https://oss.sonatype.org/content/repositories/releases/jp/spring-boot-reference/smart-date-generator/

SmartDateGenerator

SmartDateGenerator convert Date/Calendar/String object to another object simply ( by one-liner ).

This library also help you to do date-caliculation with simple method-chain .

Usage

Generate Data from Date or Calender Object.

/* 2019/01/20 */ 


// generate CalenderObject from dateObject.
SmartDateGenerator.generateDate(new Date()).toCalender() // -> Calender Object.

// generate DateObject from CalenderObject.
SmartDateGenerator.generateDate(Calender.getInstance()).toDate() // -> Date Object.

// generate String from Object and given format.
SmartDateGenerator.generateDate(new Date()).toString("yyyy/MM/dd") -> "2019/01/20"

GenerateData from DateString and format

You can get date-Data easily from dateString and it's format.

SmartDateGenerator.generateDate("2017/05/04 11:22", "yyyy/MM/dd").toDate() 
// -> Thu May 04 00:00:00 JST 2017

SmartDateGenerator.generateDate("2017/05/04 11:22", "yyyy/MM/dd").toCalender()
// -> CalenderObject (2017/05/04)

Date-caliculation

you can caliculate date with method-chain

// 90 days after .
SmartDateGenerator.generateDate(new Date()).dayChange(90).toString("yyyy/MM/dd") // -> 2019/04/20

// 90 days before.
SmartDateGenerator.generateDate(new Date()).dayChange(-90).toString("yyyy/MM/dd") // -> 2018/10/22

calicate result can also be Date,Calender of cource.

// 90 days after .
SmartDateGenerator.generateDate(new Date()).dayChange(90).toDate() // -> DateObject()

// 90 days before.
SmartDateGenerator.generateDate(new Date()).dayChange(-90).toCalender() // -> CalenderObject

Set timezone

SmartDateGenerator.generateDate(testDate()).dayChange(-30).setTimeZone(TimeZone.getTimeZone("US/Alaska")).toString("yyyy/MM/dd")
// -> 2018/12/21

simple usage.

// this return DateObject (time is now).
SmartDateGenerator.generateDate().toDate() // -> Date (date:Sun Jan 20 22:33:22 JST 2019 )

Dependency

Maven

<dependency>
    <groupId>jp.spring-boot-reference</groupId>
    <artifactId>smart-date-generator</artifactId>
    <version>1.0</version>
</dependency>

Gradle

compile 'jp.spring-boot-reference:smart-date-generator:1.0'

Versions

Version
1.0