Skip to content

KevinHM/NVDate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Build Status

NVDate is library for handling NSDate manipulation in iOS Development.

Features

NVDate have many features that help to solve your problem.

  • Capable to do lot of date manipulation task
  • User friendly naming convention
  • Chainable functions
  • Easy to use
  • Open Source !

Installation

Manually

Download the source, copy both NVDate.h and NVDate.m files to your project, then import it.

#import "NVDate.h"

CocoaPods

Installing NVDate using CocoaPods is easier. Simply add the following line to your Podfile :

pod 'NVDate'

Simple Example

Full date of today

NVDate *date = [[NVDate alloc] initUsingToday];
NSLog(@"today is : %@", [date stringValue]);

// today is : Wednesday, February 5, 2014, 4:56:35 PM Western Indonesia Time

Last day's date of next 2 months

NVDate *date = [[NVDate alloc] initUsingToday];
[date nextMonths:2];
[date lastDayOfMonth];
NSLog(@"next 2 months from today is : %@", [date stringValueWithFormat:@"dd-MM-yyyy"]);

// next 2 months from today is : 30-04-2014

Second week of 2 months ago

NVDate *date = date = [[[[[NVDate alloc] initUsingToday] previousMonths:2] firstDayOfMonth] nextWeek];
date.dateFormatUsingString = @"yyyy-MM-dd HH:mm:ss";
NSLog(@"second week of 2 months ago is : %@", [date stringValue]);

// second week of 2 months ago is : 2013-12-08 17:03:36

Detect if yesterday is friday

BOOL isFriday = [[[[NVDate alloc] initUsingToday] previousDay] isCurrentDayName:NVDayUnitFriday];
NSLog(@"is yesterday was friday ? %@", isFriday ? @"yes" : @"no");

// is yesterday was friday ? no

Documentation

https://github.com/novalagung/NVDate/wiki/API-Reference

Contribution

Feel free to add contribution to this project by fork -> pull request

License

http://novalagung.mit-license.org/

About

Make NSDate manipulation goes easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published