Skip to content

slimane-swift/Time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Time

A Time module for Swift that wraps tm in C

Usage

var t = Time()
print(t) // => %A, %B %d %Y %X formated datetime string

t.addDay(1)
t.format("%a, %d %b %Y %H:%M:%S %z")

Apis

Initializer

init(tz: TimeZone = .Local, unixtime: Int? = nil)

The TimeZone Enum

public enum TimeZone {
    case UTC
    case Local
}

Public Members

  • rfc822
  • rfc1123
  • unixtime
  • week
  • year
  • month
  • yday
  • day
  • hour
  • min
  • sec

Public Methods

  • addDay(x: Int) -> Time
  • addHour(x: Int) -> Time
  • addMin(x: Int) -> Time
  • addSec(x: Int) -> Time
  • format(format: String) -> String
    • format: The Format string set for strftime in c lang

Package.swift

import PackageDescription

let package = Package(
	name: "MyApp",
	dependencies: [
      .Package(url: "https://github.com/slimane-swift/Time", majorVersion: 0, minor: 1)
  ]
)

License

Time is released under the MIT license. See LICENSE for details.

About

A Time module for Swift that wraps tm in C

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages