代码方法:

//日期阳历转换为农历;
- (NSString *)convertDateToNongLi:(NSString *)aStrDate
{
NSDate *dateTemp = nil;
NSDateFormatter *dateFormater = [[NSDateFormatter alloc]init];
[dateFormater setDateFormat:@"yyyy-MM-dd"];
dateTemp = [dateFormater dateFromString:aStrDate]; NSCalendar* calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSChineseCalendar];
NSDateComponents* components = [calendar components:NSMonthCalendarUnit|NSDayCalendarUnit fromDate:dateTemp];
NSString* nongliMonth = [UserInfo sharedUserInfo].chineseMonths[components.month-1];
NSString* nongliDay = [UserInfo sharedUserInfo].chineseDays[components.day-1];
NSString* nongliString = [NSString stringWithFormat:@"%@%@",nongliMonth,nongliDay]; return nongliString;
}

 使用:

    NSString *strDate = @"2012-06-24";
NSString *nongLi = [self convertDateToNongLi:strDate];

  

IOS 将公历日期转换为中国农历的更多相关文章

  1. iOS 获取公历、农历日期的年月日

    iOS 获取公历.农历日期的年月日 介绍三种方法获取 Date (NSDate) 的年月日. 用 date 表示当前日期.测试日期为公历 2017 年 2 月 5 日,农历丁酉年,鸡年,正月初九. l ...

  2. Cocoa公历和中国农历直接的转换

    看过某书上面的做法是先生成一个公历的calendar,使用的是: NSCalendar *cal = [NSCalendar currentCalendar]; 然后用它生成一个NSDateCompo ...

  3. Java 实现输入公历日期输出农历日期、生肖、天干地支、节日、节气等信息

    最近的工作中客户要求前台页面展示日历,日历内容包括:农历年月日日.公历年月日.生肖.天干地支.农历节日.公历节日.24节气等信息,之前在网上查找资料关于Java实现方面的文章不少,但是大多数针对节气. ...

  4. iOS中的日期和时间

    转载于http://www.jianshu.com/p/ee279c175cf8 一.时间和日期计算 我们在应用开发中,时常需要和时间打交道,比如获取当前时间,获取两个时间点相隔的时间等等,在iOS开 ...

  5. IOS时间与日期处理

    本文转载至 http://blog.sina.com.cn/s/blog_9cd1705d0102v5x4.html   主要有以下类: NSDate -- 表示一个绝对的时间点NSTimeZone ...

  6. 从.net复制源代码中国农历阵列,必要做日历

    从.net复制源代码中国农历阵列,必要做日历 const { 闰月的月份.春节的阳历日期(农历正月初一).农历的每一个月天数 } c_arrLunarInfo: array [1900 .. 2100 ...

  7. Java 毫秒转换为日期类型、日期转换为毫秒

    /毫秒转换为日期 public static void main(String[] args) { DateFormat formatter = new SimpleDateFormat(" ...

  8. 简单的分页存储过程,Json格式日期转换为一般日期

    简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count I ...

  9. C# 日期转换为中文大写

    /// <summary> /// 日期转换为中文大写 /// </summary> public class UpperConvert { public UpperConve ...

随机推荐

  1. 【JavaScript代码实现三】JS对象的深度克隆

    function clone(Obj) { var buf; if (Obj instanceof Array) { buf = []; // 创建一个空的数组 var i = Obj.length; ...

  2. [转]Android Message.obtain() 和Handler.obtainMessage()的区别

        目录(?)[+]   参考:http://www.2cto.com/kf/201311/255885.html http://www.cnblogs.com/over140/archive/2 ...

  3. CodeForces 81D.Polycarp's Picture Gallery 乱搞

    D. Polycarp's Picture Gallery time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  4. wikioi 1068 乌龟棋

    四维dp表示分别用了多少张卡后可以获得的最大分数 #include <cstdio> #include <cmath> #include <cstring> #in ...

  5. bio、nio、aio及select、poll、epoll

    BIO与NIO.AIO的区别http://blog.csdn.net/skiof007/article/details/52873421 select.poll.epoll之间的区别总结http:// ...

  6. 五子棋游戏 canvas 事件 边界检测

    //有一定基础的人才能看得懂 <!doctype html><html lang="en"> <head> <meta charset=& ...

  7. 简易配置Django的Static文件

    http://blog.csdn.net/hireboy/article/details/8806098 Django 1.3以后,采用static方式处理静态文件,比如网站的css js image ...

  8. Vi 编辑

    1.vi的基本概念  基本上vi可以分为三种状态,分别是命令模式(command mode).插入模式(Insert mode)和底行模式(last line mode),各模式的功能区分如下: 1) ...

  9. 常用的快速Web原型图设计工具

    做产品原型是非常重要的一个环节,做产品原型就会用使用各式各样的工具.在PM朋友们的推荐下使用了很多各种各样的软件,当然选择一款真正适合自己的工具也是很重要,在这里就把我使用过的工具都介绍一下. 主要有 ...

  10. matlab 文件遍历

    function MyGetFiles(F)path=F;filelist=dir(fullfile(path,'*.JPG'));n=length(filelist);for i=1:n f=str ...