GithubHelp home page GithubHelp logo

strftime's Introduction

strftime

Build Status Coverage Status License Version

strftime is an implementation of the strftime standard C function for the Scala programming language.

Example

The following example program shows how to use the convenience functions to write the current time (when this readme was written), a java.time.LocalDate object and a java.time.LocalDateTime.

import java.time.{LocalDate, LocalDateTime, OffsetDateTime}

import xyz.hyperreal.strftime.Strftime


object Main extends App {

  println( Strftime.format("%Y-%m-%d %H:%M") )
  println( Strftime.format("%b %d, %y", LocalDate.parse("2016-03-14")) )
  println( Strftime.format("%a, %b %d, %y at %R", LocalDateTime.parse("2016-03-14T10:47")) )
  println( Strftime.format("%a, %d %b %Y %T %z", OffsetDateTime.parse("2018-05-09T13:09:49.721-04:00")) )
  println( LocalDateTime.parse("Wednesday, May 9, 2018 1:09:49 PM", Strftime.convert("%c")) )

}

This program printed

2018-04-20 12:12
Mar 14, 16
Mon, Mar 14, 16 at 10:47
Wed, 09 May 2018 13:09:49 -0400
2018-05-09T13:09:49

Usage

Use the following definition to use strftime in your Maven project:

<repository>
  <id>hyperreal</id>
  <url>https://dl.bintray.com/edadma/maven</url>
</repository>

<dependency>
  <groupId>xyz.hyperreal</groupId>
  <artifactId>strftime</artifactId>
  <version>0.2.3</version>
</dependency>

Add the following to your build.sbt file to use strftime in your SBT project:

resolvers += "Hyperreal Repository" at "https://dl.bintray.com/edadma/maven"

libraryDependencies += "xyz.hyperreal" %% "strftime" % "0.2.3"

Building

Requirements

  • Java 8
  • SBT 1.1.4+
  • Scala 2.12.5+

Clone and Run the Tests

git clone git://github.com/edadma/strftime.git
cd strftime
sbt test

License

ISC © 2018 Edward Maxedon

strftime's People

Contributors

edadma avatar

Watchers

James Cloos avatar  avatar

Forkers

ejiro-precious

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.