IOS 将公历日期转换为中国农历
代码方法:
//日期阳历转换为农历;
- (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 将公历日期转换为中国农历的更多相关文章
- iOS 获取公历、农历日期的年月日
iOS 获取公历.农历日期的年月日 介绍三种方法获取 Date (NSDate) 的年月日. 用 date 表示当前日期.测试日期为公历 2017 年 2 月 5 日,农历丁酉年,鸡年,正月初九. l ...
- Cocoa公历和中国农历直接的转换
看过某书上面的做法是先生成一个公历的calendar,使用的是: NSCalendar *cal = [NSCalendar currentCalendar]; 然后用它生成一个NSDateCompo ...
- Java 实现输入公历日期输出农历日期、生肖、天干地支、节日、节气等信息
最近的工作中客户要求前台页面展示日历,日历内容包括:农历年月日日.公历年月日.生肖.天干地支.农历节日.公历节日.24节气等信息,之前在网上查找资料关于Java实现方面的文章不少,但是大多数针对节气. ...
- iOS中的日期和时间
转载于http://www.jianshu.com/p/ee279c175cf8 一.时间和日期计算 我们在应用开发中,时常需要和时间打交道,比如获取当前时间,获取两个时间点相隔的时间等等,在iOS开 ...
- IOS时间与日期处理
本文转载至 http://blog.sina.com.cn/s/blog_9cd1705d0102v5x4.html 主要有以下类: NSDate -- 表示一个绝对的时间点NSTimeZone ...
- 从.net复制源代码中国农历阵列,必要做日历
从.net复制源代码中国农历阵列,必要做日历 const { 闰月的月份.春节的阳历日期(农历正月初一).农历的每一个月天数 } c_arrLunarInfo: array [1900 .. 2100 ...
- Java 毫秒转换为日期类型、日期转换为毫秒
/毫秒转换为日期 public static void main(String[] args) { DateFormat formatter = new SimpleDateFormat(" ...
- 简单的分页存储过程,Json格式日期转换为一般日期
简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count I ...
- C# 日期转换为中文大写
/// <summary> /// 日期转换为中文大写 /// </summary> public class UpperConvert { public UpperConve ...
随机推荐
- python开发_tkinter_多级子菜单
在之前的blog中有提到python的tkinter中的菜单操作 python开发_tkinter_窗口控件_自己制作的Python IDEL_博主推荐 python开发_tkinter_窗口控件_自 ...
- Codeforces Round #254 (Div. 1) C. DZY Loves Colors 分块
C. DZY Loves Colors 题目连接: http://codeforces.com/contest/444/problem/C Description DZY loves colors, ...
- js取float型小数点后x位数的方法
js中取小数点后两位方法最常用的就是四舍五入函数了,前面我介绍过js中四舍五入一此常用函数,这里正好用上,下面我们一起来看取float型小数点后两位一些方法总结 以下我们将为大家介绍 JavaScri ...
- Jmeter+JDK的安装学习笔记
第一步:首先从jmeter的官网下载jmeter,目前最新版本为3.3,支持的JDK最高为1.8 下载地址: jmeter:http://jmeter.apache.org/download_jmet ...
- How To Allow Blocked Content on Internet Explorer
Follow the steps below if you are tired of having to "Enable Blocked Content" in IE each t ...
- InvalidateRect(转)
///===================该段是自己总结的一个小结================================= InvalidateRect()函数的作用是设置一个无效区域,并 ...
- linux下安装MYSQL详细配置(转)
#tar zxvf mysql-5.0.18.tar.gz#cd mysql-5.0.18 #./configure --prefix=/usr/local/mysql --with-chars ...
- joel 相关
1. stack overflow , http://blog.jobbole.com/102810/, stack overflow 提问也是一门学问. 2. tello 类似于 leangoo,一 ...
- Python kmean
# -*- coding: utf-8 -*-from sklearn.cluster import KMeansfrom sklearn.externals import joblibimport ...
- UT-Austin大学在Image search and large-scale retrieval方面的一系列papers
WhittleSearch: Interactive Image Search with Relative Attribute Feedback. A. Kovashka, D. Parikh, a ...