Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
4725d883
Commit
4725d883
authored
Jan 25, 2016
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7a6398a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
IBTCommon.h
XFFruit/Utilities/IBTUIKit/IBTCommon.h
+2
-0
IBTCommon.m
XFFruit/Utilities/IBTUIKit/IBTCommon.m
+9
-2
No files found.
XFFruit/Utilities/IBTUIKit/IBTCommon.h
View file @
4725d883
...
...
@@ -51,4 +51,6 @@
+
(
NSInteger
)
getWeeks
:(
NSInteger
)
year
;
+
(
NSString
*
)
weekdayStringFromDate
:(
NSDate
*
)
inputDate
;
+
(
NSString
*
)
countNumAndChangeformat
:(
NSString
*
)
num
;
+
(
NSString
*
)
getWeekFromDateStr
:(
NSString
*
)
dataStr
;
@end
XFFruit/Utilities/IBTUIKit/IBTCommon.m
View file @
4725d883
...
...
@@ -175,6 +175,11 @@
[
formatter
setDateFormat
:
@"yyyy.MM.dd"
];
return
[
formatter
dateFromString
:
dateString
];
}
+
(
NSDate
*
)
convertToDateFromStr
:
(
NSString
*
)
dateString
{
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
[
formatter
setDateFormat
:
@"yyyy-MM-dd"
];
return
[
formatter
dateFromString
:
dateString
];
}
+
(
NSString
*
)
stringFromDate
:
(
NSDate
*
)
aDate
{
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
[
formatter
setDateFormat
:
@"yyyy-MM-dd "
];
...
...
@@ -314,8 +319,10 @@
NSString
*
yearWeek
=
@""
;
NSCalendar
*
greCalendar
=
[[
NSCalendar
alloc
]
initWithCalendarIdentifier
:
NSGregorianCalendar
];
NSDateComponents
*
dateComponents
=
[
greCalendar
components
:
NSYearCalendarUnit
|
NSMonthCalendarUnit
|
NSDayCalendarUnit
|
NSHourCalendarUnit
|
NSMinuteCalendarUnit
|
NSSecondCalendarUnit
|
NSWeekCalendarUnit
|
NSWeekdayCalendarUnit
|
NSWeekOfMonthCalendarUnit
|
NSWeekOfYearCalendarUnit
fromDate
:[
NSDate
date
]];
NSString
*
year
=
[
IBTCommon
stringFromDateWithFormat
:[
NSDate
date
]
format
:
@"yyyy"
];
if
(
dateComponents
.
weekOfYear
==
1
)
{
NSString
*
yearStr
=
[
IBTCommon
stringFromDateWithFormat
:[
NSDate
date
]
format
:
@"yyyy-MM-dd"
];
NSString
*
year
=
[
yearStr
substringToIndex
:
4
];
NSString
*
month
=
[
yearStr
substringWithRange
:
NSMakeRange
(
5
,
2
)];
if
(
dateComponents
.
weekOfYear
==
1
&&
[
month
isEqualToString
:
@"12"
])
{
yearWeek
=
[
NSString
stringWithFormat
:
@"%ld-%ld"
,
[
year
integerValue
]
+
1
,(
long
)
dateComponents
.
weekOfYear
];
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment