YFCalendar----最新版自写日历

SSLunarDate:SSLunarDate SSLunarDate SSLunarDate 这是一个iOS中文农历日期框架,可以将NSDate转换为在中国广泛使用的农历日期。 该代码是由GPL2许可的,即使我也获得了其他一些许可,但是由于该算法的核心是由GPL许可的,因此我没有其他选择。 谈到此库的用法,您可以参考SSLunarDate.h以获得详细信息,在这里我可以举一个小例子。 SSLunarDate *lunar = [[SSLunarDate alloc] init]; NSLog(@"month:%@ day:%@", [lunar monthString], [lunar dayString]); NSLog(@"full string:%@ %@", [lunar string], [lunar zodiacString]); 你可以得到这个: month:正月 day:廿九 full string:癸巳 立即下载

简介

最新版的自己写的日历,有农历和阳历。
之前写的只是为了实现功能,没有注重代码的简洁性,这次我把代码进行了一定的分类封装。水平不够,多谢指教。
有需求的可以看看~~~~~,有能力的来个星星谢谢哈
Demo传送门

框架布局

布局
最重要的就是tools和yfcollectionview的代码:
工具类包括所有的日期计算方法:

#import <Foundation/Foundation.h>
#import "SSLunarDate.h"
@interface NSObject (CalenderSet)
- (NSInteger)currentYear:(NSDate *)date;//获得当前的年份
- (NSInteger)currentMonth:(NSDate *)date;//获得当前的月份
- (NSInteger)currentDay:(NSDate *)date;//获得当前是哪一天
- (NSInteger)currentMonthOfDay:(NSDate *)date;//获得本月有多少天
- (NSInteger)preInMonth:(NSDate *)date;//获得上个月月份
- (NSInteger)nextMonth:(NSDate *)date;//获得下个月月份
- (NSInteger)preInMonthDay:(NSDate *)date;//获得上个月有多少天
- (NSInteger)currentFirstDay:(NSDate *)date;//获得这个月份第一天是在星期几
- (NSMutableArray *)currentMonthArray:(NSDate *)date;//获得这个月排布数组
- (void)changeCurrentMonth:(NSDate *)date andIndex:(int)index resultData:(void(^)(NSDate *nowDate,NSString *showMonth))block;//获得上个月或者下个月的对应的nsdate和字符串
- (SSLunarDate *)lunarDaysString:(NSDate *)date int:(int)nowIndex;//获取对应的农历
@end
#import "NSObject+CalenderSet.h"

@implementation NSObject (CalenderSet)
/**
 *  获取当前月的年份
 */
- (NSInteger)currentYear:(NSDate *)date{

    NSDateComponents *componentsYear = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [componentsYear year];
}
/**
 *  获取当前月的月份
 */
- (NSInteger)currentMonth:(NSDate *)date{

    NSDateComponents *componentsMonth = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [componentsMonth month];
}
/**
 *  获取当前是哪一天
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)currentDay:(NSDate *)date{

    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components day];
}
/**
 *  本月有几天
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)currentMonthOfDay:(NSDate *)date{

    NSRange totaldaysInMonth = [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date];
    return totaldaysInMonth.length;
}
/**
 *  本月的上一个月是第几个月
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)preInMonth:(NSDate *)date{
    //获取这个月月份
    NSInteger currentMonth = [self currentMonth:date];
    NSInteger preMonth;
    //判断上一个月是哪个月份
    if (currentMonth == 1) {
        preMonth = 12;
    }else{

        preMonth = currentMonth - 1;
    }
    return preMonth;
}
/**
 *  本月的下一个月是第几个月
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)nextMonth:(NSDate *)date{

    //获取这个月月份
    NSInteger currentMonth = [self currentMonth:date];
    NSInteger preMonth;
    //判断下一个月是哪个月份
    if (currentMonth == 12) {
        preMonth = 1;
    }else{

        preMonth = currentMonth + 1;
    }
    return preMonth;
}
/**
 *  上一个月是有多少天数
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)preInMonthDay:(NSDate *)date{

    NSInteger currnetYear = [self currentYear:date];
    NSInteger preMonth = [self preInMonth:date];
    //判断年份是不是闰年
    if (preMonth == 1 || preMonth == 3 || preMonth == 5 || preMonth == 7 || preMonth == 8 || preMonth == 10 || preMonth == 12) {
        return 31;
    }else if(preMonth == 2){
        //如果是闰年并且这个月份正好是二月份
        if(((currnetYear % 4 == 0) && (currnetYear % 100 == 0)) || (currnetYear % 400 == 0)){

            return 29;
        }else{

            return 28;
        }
    }else{

        return 30;
    }
}
/**
 *  本月第一天是星期几
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSInteger)currentFirstDay:(NSDate *)date{

    NSCalendar *calendar = [NSCalendar currentCalendar];
    //    [calendar setFirstWeekday:2];//1.mon
    NSDateComponents *comp = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    [comp setDay:1];
    NSDate *firstDayOfMonthDate = [calendar dateFromComponents:comp];

    NSUInteger firstWeekday = [calendar ordinalityOfUnit:NSCalendarUnitWeekday inUnit:NSCalendarUnitWeekOfMonth forDate:firstDayOfMonthDate];
    return firstWeekday - 1;
}
/**
 *  获得对应月份的天数数组
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (NSMutableArray *)currentMonthArray:(NSDate *)date{

    NSMutableArray *dayArray = [NSMutableArray array];
    //获取上一个月是第几个月
    NSInteger preMonth = [self preInMonth:date];
    //获取上一个月天数
    NSInteger preDay = [self preInMonthDay:date];
    //获取下一个月是第几个月
    NSInteger nextMonth = [self nextMonth:date];

    //当月月份
    NSInteger currentMonth = [self currentMonth:date];

    NSInteger day = [self currentFirstDay:date];
    for (NSInteger i = 0; i < day; i++){
        //存入字典
        NSDictionary *preDic = @{@"month":@(preMonth),@"day":@(preDay - day + i + 1),@"status":@"pre"};
        [dayArray addObject:preDic];
    }

    NSInteger days = [self currentMonthOfDay:date];

    for (NSInteger i = 1; i <= days; i++) {
        //存入字典
        NSDictionary *currentDic = @{@"month":@(currentMonth),@"day":@(i),@"status":@"current"};
        [dayArray addObject:currentDic];
    }
    //把剩下的空间置为空
    int lastCount = 1;
    for (NSInteger i = dayArray.count; i < 42; i ++) {
        //存入字典
        NSDictionary *nextDic = @{@"month":@(nextMonth),@"day":@(lastCount),@"status":@"next"};
        [dayArray addObject:nextDic];
        lastCount ++;
    }
    return dayArray;
}
/**
 *  获得对应的nsdate和显示的年份月份
 *
 */
- (void)changeCurrentMonth:(NSDate *)date andIndex:(int)index resultData:(void(^)(NSDate *nowDate,NSString *showMonth))block{

    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    dateComponents.month = index;
    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    if (block) {
        block(newDate,[NSString stringWithFormat:@"%li年%li月",(long)[self currentYear:newDate],(long)[self currentMonth:newDate]]);
    }

}
/**
 *  获取对应的农历
 *
 *  @return <#return value description#>
 */
- (SSLunarDate *)lunarDaysString:(NSDate *)date int:(int)nowIndex{

    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];

    //设置天数
    [dateComponents setDay:nowIndex];

    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    SSLunarDate *lunar = [[SSLunarDate alloc] initWithDate:newDate];
    return lunar;
}
@end

然后是collectionview布局:

#import "YFCollectionView.h"
#import "YFCell.h"
#import "NSObject+CalenderSet.h"
#import "SSLunarDate.h"
@interface YFCollectionView()<UICollectionViewDelegate,UICollectionViewDataSource>

@end
@implementation YFCollectionView
/**
 *  init
 *
 */
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{

    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        _allDayArray = [NSMutableArray array];
        self.delegate = self;
        self.dataSource = self;
        self.backgroundColor = [UIColor whiteColor];
        //set layout
        [self setLayOut];
        // register
        [self registerClass:[YFCell class] forCellWithReuseIdentifier:@"cell"];
    }
    return self;
}
- (void)setAllDayArray:(NSMutableArray *)allDayArray{

    _allDayArray = allDayArray;
    [self reloadData];
}
/**
 *  set lauOut
 */
- (void)setLayOut{

    UICollectionViewFlowLayout *layOut = [[UICollectionViewFlowLayout alloc]init];
    layOut.itemSize = CGSizeMake(self.frame.size.width / 7, self.frame.size.height / 7);
    layOut.minimumLineSpacing = 0.0;
    layOut.minimumInteritemSpacing = 0.0;
    [self setCollectionViewLayout:layOut];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{

    return 35;

}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    YFCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    NSDictionary *dic = self.allDayArray[indexPath.row];
    cell.dateLabel.text = [NSString stringWithFormat:@"%@",dic[@"day"]];
    //农历,需要判断月份,年份
    __weak typeof(self)weakSelf = self;
   __block NSString *lunarStr;
    if ([dic[@"status"] isEqualToString:@"pre"]) {//上一个月
        [self changeCurrentMonth:_date andIndex:-1 resultData:^(NSDate *nowDate, NSString *showMonth) {

            SSLunarDate *sdate = [weakSelf lunarDaysString:nowDate int:[dic[@"day"] intValue]];
            lunarStr = [NSString stringWithFormat:@"%@",[sdate dayString]];
        }];
    }else if ([dic[@"status"] isEqualToString:@"next"]){//下一个月

        [self changeCurrentMonth:_date andIndex:1 resultData:^(NSDate *nowDate, NSString *showMonth) {

            SSLunarDate *sdate = [weakSelf lunarDaysString:nowDate int:[dic[@"day"] intValue]];
            lunarStr = [NSString stringWithFormat:@"%@",[sdate dayString]];
        }];
    }else{

        SSLunarDate *sdate = [self lunarDaysString:_date int:[dic[@"day"] intValue]];
        lunarStr = [NSString stringWithFormat:@"%@",[sdate dayString]];
    }
    cell.lunarLabel.text = lunarStr;
    return cell;
}
/**
 *  选择单元格
 *
 *  @param collectionView <#collectionView description#>
 *  @param indexPath      <#indexPath description#>
 */
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{

    NSDictionary *dic = self.allDayArray[indexPath.row];
    NSLog(@"%li年 %i月 %i日 ",(long)[self currentYear:_date],[dic[@"month"] intValue],[dic[@"day"] intValue]);
}
@end

然后,用scrollview布局,可以左右滑动日历显示:

#import "ShowView.h"
#import "YFCollectionView.h"
#import "NSObject+CalenderSet.h"
@interface ShowView()
@property(nonatomic,strong)NSDate *date;
@property(nonatomic,strong)YFCollectionView *leftCollectionView;//左侧
@property(nonatomic,strong)YFCollectionView *centerCollectionView;//中间
@property(nonatomic,strong)YFCollectionView *rightCollectionView;//右侧
@end
@implementation ShowView
/**
 *  init
 *
 *  @return <#return value description#>
 */
+ (instancetype)createView{

    return [[[NSBundle mainBundle]loadNibNamed:@"ShowView" owner:nil options:nil] lastObject];
}
/**
 *  set view
 */
- (void)awakeFromNib{

    _date = [[NSDate alloc]init];
    //显示的日期
    [_centerBtn setTitle:[NSString stringWithFormat:@"%li年 %li月 %li日",[self currentYear:_date],[self currentMonth:_date],[self currentDay:_date]] forState:UIControlStateNormal];

    _scrollView.pagingEnabled = YES;
    _scrollView.showsVerticalScrollIndicator = NO;
    _scrollView.showsHorizontalScrollIndicator = NO;
    _scrollView.contentSize = CGSizeMake(3 * _scrollView.frame.size.width, 0);
    // add collectionview
    for (int i = 0; i < 3; i ++) {
        YFCollectionView *collectionView = [[YFCollectionView alloc]initWithFrame:CGRectMake(i * _scrollView.frame.size.width, 0, _scrollView.frame.size.width, _scrollView.frame.size.height) collectionViewLayout:[[UICollectionViewFlowLayout alloc]init]];
        collectionView.tag = i + 1001;
        [self.scrollView addSubview:collectionView];
    }
    self.leftCollectionView = (YFCollectionView *)[self viewWithTag:1001];
    self.centerCollectionView = (YFCollectionView *)[self viewWithTag:1002];
    self.rightCollectionView = (YFCollectionView *)[self viewWithTag:1003];
    //数据
    self.centerCollectionView.date = _date;
    self.centerCollectionView.allDayArray = [self currentMonthArray:_date];

    //左侧
    [self changeCurrentMonth:_date andIndex:-1 resultData:^(NSDate *nowDate, NSString *showMonth) {
        self.leftCollectionView.date = nowDate;
        self.leftCollectionView.allDayArray = [self currentMonthArray:nowDate];
    }];

    //右侧
    [self changeCurrentMonth:_date andIndex:1 resultData:^(NSDate *nowDate, NSString *showMonth) {
        self.rightCollectionView.date = nowDate;
        self.rightCollectionView.allDayArray = [self currentMonthArray:nowDate];
    }];


    self.scrollView.contentOffset = CGPointMake(self.scrollView.frame.size.width, 0);

}
/**
 * click pre btn
 *
 *  @param sender <#sender description#>
 */
- (IBAction)clickPreBtn:(UIButton *)sender {

    [self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x - self.scrollView.frame.size.width, 0) animated:YES];
}
/**
 *  clicknext btn
 *
 *  @param sender <#sender description#>
 */
- (IBAction)clickNextBtn:(UIButton *)sender {

    [self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x + self.scrollView.frame.size.width, 0) animated:YES];
}
/**
 *  click center btn
 *
 *  @param sender <#sender description#>
 */
- (IBAction)clickCenterBtn:(UIButton *)sender {
}
/**
 *  scrollview delegate
 *
 */
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

    //判断
    if (self.scrollView.contentOffset.x <= 0) {
        self.scrollView.contentOffset = CGPointMake(self.scrollView.frame.size.width, 0);
        //数据重新赋予
        //中间数据
        __weak typeof(self)weakSelf = self;
        [self changeCurrentMonth:_date andIndex:-1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.centerCollectionView.date = nowDate;
            self.centerCollectionView.allDayArray = [self currentMonthArray:nowDate];

            [weakSelf.centerBtn setTitle:showMonth forState:UIControlStateNormal];
            weakSelf.date = nowDate;

        }];


        //左侧
        [self changeCurrentMonth:_date andIndex:-1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.leftCollectionView.date = nowDate;
            self.leftCollectionView.allDayArray = [self currentMonthArray:nowDate];
        }];

        //右侧
        [self changeCurrentMonth:_date andIndex:1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.rightCollectionView.date = nowDate;
            self.rightCollectionView.allDayArray = [self currentMonthArray:nowDate];
        }];
    }else if (self.scrollView.contentOffset.x >= self.scrollView.frame.size.width * 2.0){

        self.scrollView.contentOffset = CGPointMake(self.scrollView.frame.size.width, 0);
        //数据重新赋予
        //中间数据
        __weak typeof(self)weakSelf = self;
        [self changeCurrentMonth:_date andIndex:1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.centerCollectionView.date = nowDate;
            self.centerCollectionView.allDayArray = [self currentMonthArray:nowDate];
            [weakSelf.centerBtn setTitle:showMonth forState:UIControlStateNormal];

            weakSelf.date = nowDate;
        }];


        //左侧
        [self changeCurrentMonth:_date andIndex:-1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.leftCollectionView.date = nowDate;
            self.leftCollectionView.allDayArray = [self currentMonthArray:nowDate];
        }];

        //右侧
        [self changeCurrentMonth:_date andIndex:1 resultData:^(NSDate *nowDate, NSString *showMonth) {
            self.rightCollectionView.date = nowDate;
            self.rightCollectionView.allDayArray = [self currentMonthArray:nowDate];
        }];
    }
}
@end

结语

我希望的是你可以根据我的代码思路,自己写出这一功能的代码。而不是让你直接command+c,command+v。请不要要你很忙,没有时间。Cheat ghost 。

ArcGIS遥感影像分类技术在植被覆盖度计算中的应用 本文详细介绍了如何利用ArcGIS遥感影像分类技术高效计算植被覆盖度。通过数据准备、监督与非监督分类方法详解,并结合制表分析与栅格计算器进行面积统计,最终实现从分类图到覆盖度百分比的全流程自动化与可视化,为生态评估与规划提供精准数据支持。 阅读详情

相关推荐

别再花屏了!手把手教你用STM32CubeIDE搞定LVGL 8.3移植(附完整源码)

本文详细介绍了如何在STM32CubeIDE环境下成功移植LVGL 8.3,解决常见的花屏问题。从环境配置、显示驱动优化到编译警告处理,提供完整的实战方案和源码示例,帮助开发者快速实现流畅的嵌入式GUI界面。特别针对STM32平台的DMA2D加速和内存管理进行了深度优化。

weixin_33739646的博客 244

iOS 日历类(NSCalendar)

对于时间的操作在开发中很常见,但有时候我们需要获取到一年后的时间,或者一周后的时间.靠通过秒数计算是不行的.那就牵扯到另外一个日历类(NSCalendar).下面先简单看一下 NSDate let date = NSDate()let formatter = NSDateFormatter() formatter.dateFormat = "yyyy-MM-dd HH-mm-ss"forma...

weixin_33781606的博客 282

【NVIDIA Jetson Orin系列 - 安装NVIDIA SDK Manager】

NVIDIA Jetson Orin - 安装NVIDIA SDK Manager

dally2的博客 2697

iOS - Swift NSCalendar 日历

&#13; 前言 public class NSCalendar : NSObject, NSCopying, NSSecureCoding NSCalendar 对世界上现存的常用的历法进行了封装,既提供了不同历法的时间信息,又支持日历的计算。 NSCalendar -- 日历类,它提供了大部分的日期计算接口,并且允许您在 NSDate 和 NSDateComp...

rstbfveradsvc 605

CSI Tools 工具的安装 Intel 5300 + Ubuntu14.04

在 ubuntu14 系统上面安装 CSI Tools,2020最新教程,亲测可用,只要保证和我做法一致绝对可以安装好。

WS的小屋 1万+

倍福 MODBUS TCP/IP通信

(*默认字符串80字节,此处声明为255字节,可以一次性传42个UINT数据.5位整数加一个空格,即每个数据6字节*)(*---------------------------------------- 以下为用户程序 ----------------------------------------*)(*读回并换算后的值*)(*准备写到PLC的值*)(*用于比较两次读回的值相差多少,以估计通讯的速度, Act_CalcDiff*)(*用于切换读和写,Act_Protocal*)

qq_33280096的博客 1368

iOS Swift 将公历日期转换为中国农历

将Date转换为中国农历 func convertDateToNongLi(aStrDate:Date)-> String{ // MARK: - 农历格式数据 let cDayName = [ "初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", ..

m0_67693711的博客 1378

别再只玩积木了!用乐高EV3和官方软件,手把手教你做个能巡线的小车(附完整代码)

本文详细介绍了如何利用乐高EV3套件和官方软件制作智能巡线机器人,从硬件组装到软件编程全面覆盖。通过传感器原理讲解、控制算法调试等工程化细节,帮助读者掌握机器人开发的核心理念,特别适合STEAM教育和硬件编程爱好者实践。

weixin_30776273的博客 454

通过UICollectionView 自定义日历(Calendar)添加、编辑以及删除事件等操作

本篇文章主要介绍一下我在自定义日历这个Demo中所用到的系统类库和第三方类库以及遇到的一些问题 使用到的类库 系统类库EventKitUI.framework 和 EventKit.framework 第三方类库SSLunarDate SSLunarDate 可以通过CocoaPods进行安装 pod ‘SSLunarDate’, ‘~> 0.0.1’,

u012661893的专栏 3412

基于 STM32 与压电薄膜的婴儿睡眠呼吸暂停监测床垫设计

本设计以 STM32F103C8T6 为主控,结合 PVDF 压电薄膜传感器,通过模拟信号调理与数字峰值检测算法,实现了对婴儿睡眠呼吸状态的实时监测。系统结构简单、成本低廉、无接触无束缚,当检测到 20 秒以上无呼吸信号时自动触发声光报警,可有效降低婴儿睡眠呼吸暂停带来的安全风险。后续可扩展蓝牙 / WiFi 模块,将报警信息推送至家长手机端,实现远程监护。

weixin_42300449的博客 154

论文研读 Corundum: An Open-Source 100-Gbps NIC

Corundum 通过在 FPGA 上构建并行 pipeline、高效 DMA 通道、无阻塞队列结构、低延迟调度器,实现了在 PCIe Gen3 x16 接口上稳定跑满 100Gbps 吞吐量。

Double Galaxy 491

Borax.Lunardate:中国农历日期

原文地址:https://kinegratii.github.io/2019/01/05/lunardate-module/ 感谢原作者!本人只是搬运工。看完这个和上一篇基本对农历就有了一个较全面的认识。 本文简要介绍了我国传统的农历历法知识,并叙述了 Borax-Lunar 工具库开发背后的一些算法原理和技术资料。 目录 1 农历概述 1.1 编排规则 1.2 表示方法 1.3 二十四节气 2 数据结构 2.1 大小月和闰月 2.2 节气的数据结构 3 Borax-Lunardate

kim5659的博客 3696

ESP32设备驱动-TM1637-驱动4位7段数码管

TM1637是一款带键盘扫描接口的LED(发光二极管显示器)驱动控制专用电路,内部集成了MCU数字接口、数据锁存、LED高压驱动、键盘扫描等功能。 TM1637使用DIP20/SOP20封装,主要适用于电磁炉、微波炉、小家电的显示驱动。

视觉与物联智能 2121

python 阴历转阳历

在上述代码中,首先我们需要输入要转换的阴历年、月、日。然后,将输入的阴历日期转换为lunardate库中的对象,接着使用toSolarDate()方法将阴历日期转换为阳历日期。最后,输出阳历日期即可。在日常生活中,很多人都需要使用农历,但是对于程序员来说,将农历转换为阳历是一个很容易的工作。在Python中,我们可以使用lunardate库来实现阴历到阳历的转换。

whatday的专栏 994

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

uni-calendar日历组件更改标点颜色和位置及多个标点显示

uni-calendar日历组件更改标点颜色和位置及多个标点显示

m0_58293192的博客 6549

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

uni-app实现日历效果:使用u-calendar设置最大可选时间,使用时间戳,点击确认选择之后以需要的格式返回页面上

u-calendar设置最大可选时间(max_date) 官方文档是这样的: max-date="2022-01-01"这样的格式就可以 <u-calendar v-model="show" ref="calendar" @change="change" :mode="mode" :active-bg-color="activeBgColor" :btn-type="btnType" max-date="2022-01-01"> </u-calendar> 若要使最大可选

qq_44429079的博客 1万+

java中string与date(日期)格式之间的转换

经常遇到string和date之间的转换,把相关的内容总结在这里吧: 1.string格式转化为Date对象: //把string转化为date DateFormat fmt =new SimpleDateFormat("yyyy-MM-dd"); Date date = fmt.parse(szBeginTime); test.setStartTime(date);

漂泊小柒的专栏 25万+

JAVA日期操作大全

一、前言 在开发过程中,少不了与时间打交道,比如根据两个日期得出相差的时分秒,时间加减,时间累加,前5分钟,前一个月,前一年,等等... 而我最近开发和时间操作的比较频繁,所以记录下,和时间操作有关的代码。 在JAVA中有六个与时间有关的类: java.util.Date java.sql.Date java.sql.Time java.sql.Timest

fendo 1万+

日历Calendar详解

/* simpleDateFormat,时间格式 currentTimeMillis 当前时间*/import java.util.Calendar;import java.util.Date;import java.text.*;public class fuck11{ public static void main(String[] args){ //返回一个日历格式的静态变量 Ca...

rolic_的博客 1270

vue-calendar基于vue的日历插件

本文转载于https://www.cnblogs.com/zwhgithub/p/8005414.html vue-calendar-component 基于 vue 2.0 开发的轻量,高性能日历组件 占用内存小,性能好,样式好看,可扩展性强 原生 js 开发,没引入第三方库 效果 Install npm i vue-calendar-component --save cnpm...

Calmlyx的博客 3万+

vue-mobile-calendar日期选择

vue移动端日期选择组件: https://segmentfault.com/a/1190000013284700 vue-mobile-calendar: https://lx544690189.github.io/vue-mobile-calendar/

qq_23111247的博客 4575

lunar农历

/** * 提供一些农历相关信息 * @author 林志斌(ialvin.cn) 广东 普宁 里湖 */ public class Lunar { static long day; static java.util.Date date; /* public static void main(String[] args) { SimpleDateFormat myFo

非淡泊无以明志,非宁静无以致远 5947

日期工具类,Srting工具类,常用方法封装

public class DateUtils {     /**      * 从一组日期中找到最大的      * @param dates      * @return      */     public static Date max(Date[] dates) {         Date md = dates[0];         for (int i = 0; i &lt; da...

yf_yf_yf_yf的博客 281

日期、时间选择控件 - datetimepicker

http://www.bootcss.com/p/bootstrap-datetimepicker/demo.htm 页面上添加控件 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link href="http://cdn.bootcss.com/twitter-bootstra.

博客 4323

苹果apple id无法申请开发者帐号问题

在我们申请好apple id准备申请开发者帐号时可能你会遇到一个情况: 这个问题出现的原因 就是在你申请apple id的时候,你填写的出生日期到你申请开发者的时候你没有满18岁。说白了,苹果根据你填写的出生日期判断你有没有满18岁。未满18他认为你不适合开发。

猿人在北京 9824

iOS关于model的两种写法

前言今天和大家说一说model的一些问题。model相信大家都不默生,因为对于OC来说(其他语言都应该是一样的),MVC这个模式应该都是最基本的。只要用刀MVC那么你就要用到model。在我刚刚开始OC的时候,是一种写法,当自己感觉对OC有一点点自己的理解了之后,model的写法又是另一种。今天把我自己前后对于model的两种写法写出来,让大家参考一下。 Demo链接正文第一种model写法一个m

猿人在北京 8890

enumerateObjectsUsingBlock

这是foundation里面的一个方法:- (void)enumerateObjectsUsingBlock:(void (^)(ObjectType obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0);这个方法也是一种循环的方法与for,while实现的功能一样,但是既然苹果出了这个方法,那一定有它的与众不同的地方。NSAr

猿人在北京 7228
上一篇: TableView自定义左划多个按钮
下一篇: IOS UIDevice & IOS检测屏幕旋转实例
猿人在北京
博客等级 码龄11年 92粉丝 94原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值