有人可以给我指一月中的几天源代码吗?

发布于 2024-11-07 17:05:25 字数 106 浏览 0 评论 0原文

我正在构建需要最少日历的 iOS 应用程序。真的只是一个月中的几天。有没有人遇到过简单的源代码 - c 代码很好 - 当给定月份和年份时可以生成该月的正确日期?

谢谢,
道格

I am building and iOS app that requires a minimal calendar. Just days of the month really. Has anyone come across bare bones source code - c-code is fine - that when given a month and year can generate the correct days of the month?

Thanks,
Doug

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲歌长辞 2024-11-14 17:05:25

查看 IOS 日期和时间编程指南 http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html#//apple_ref/doc/uid/TP40003470-SW1

他们有以下示例,展示了如何从 NSDate 获取星期几:

NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
                     initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
                [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
NSInteger day = [weekdayComponents day];
NSInteger weekday = [weekdayComponents weekday];

Have a look at the IOS Date and Time Programming guide http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html#//apple_ref/doc/uid/TP40003470-SW1

They have the following example showing how to get the day of the week from an NSDate:

NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
                     initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
                [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
NSInteger day = [weekdayComponents day];
NSInteger weekday = [weekdayComponents weekday];
帝王念 2024-11-14 17:05:25

我发现了这个: http://www.codecogs.com/code/units/date /daysinmonth.php 与谷歌。我不知道你是否可以用它做点什么。可悲的是,你必须在网站上注册才能下载完整的源代码......

I found this: http://www.codecogs.com/code/units/date/daysinmonth.php with google. I don't know if you can do something with it. The sad thing is that you have to register on the site to download the complete source...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文