【代码笔记】获得当前的月的天数
2016-03-22 09:20
363 查看
一,代码。
二,输出。
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSLog(@"8月的天数%ld",(long)[self getCurrentDay:8]); } #pragma -mark -functions //获得当前的月的天数 -(NSInteger )getCurrentDay:(int) currentMonth{ if (currentMonth < 8 ) { if (currentMonth %2 ==1) { return 31; }else{ return 30; } }else{ if (currentMonth %2 ==1) { return 30; }else{ return 31; } } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
二,输出。
2015-10-19 13:33:04.785 获得当前的月的天数[5116:115173] 8月的天数31
相关文章推荐
- FTP 简单命令
- Eclipse智能提示及快捷键
- Zend Framework分页类用法详解
- struts2 升级至2.5流程及主要事项
- 作业三:代码规范,代码复查
- 作业三:是否需要有代码规范?
- Java实现把excel xls中数据转为可直接插入数据库的sql文件
- eclipse设置背景颜色、字体大小、行号、XML字体大小和颜色等操作
- 《Python数据分析基础教程:Numpy学习指南》- 速记 - 第二章
- java中几种常见的排序算法
- JAVA复习2 JAVA开发环境配置
- python 之Twsited
- 解决ADB server didn't ACK问题,Eclipse项目无法正常运行
- Qt 在控件上面绘图 label,pushbutton。。。。。
- 为什么用 Java—— 一个 Python 程序员告诉你
- Thinkphp的缓存(Cache)以及S函数
- PHP基础之搭建WAMP环境
- C语言变量声明加冒号的用法(占位符)
- PHP面向对象 实例化 构造函数 封装 继承 静态
- Zend Framework生成验证码并实现验证码验证功能(附demo源码下载)