Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
without authentication
meibuyu-rpc
Commits
26428cbc
Commit
26428cbc
authored
May 14, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/djj'
parents
56d055ba
8c7bc2b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
functions.php
src/functions.php
+17
-0
No files found.
src/functions.php
View file @
26428cbc
...
...
@@ -397,3 +397,20 @@ if (!function_exists('select_id_name')) {
};
}
}
if
(
!
function_exists
(
'get_week_start_and_end'
))
{
function
get_week_start_and_end
(
$time
=
''
,
$first
=
1
)
{
//当前日期
if
(
!
$time
)
$time
=
time
();
$sdefaultDate
=
date
(
"Y-m-d"
,
$time
);
//$first =1 表示每周星期一为开始日期 0表示每周日为开始日期
//获取当前周的第几天 周日是 0 周一到周六是 1 - 6
$w
=
date
(
'w'
,
strtotime
(
$sdefaultDate
));
//获取本周开始日期,如果$w是0,则表示周日,减去 6 天
$week_start
=
date
(
'Y-m-d'
,
strtotime
(
"
$sdefaultDate
-"
.
(
$w
?
$w
-
$first
:
6
)
.
' days'
));
//本周结束日期
$week_end
=
date
(
'Y-m-d'
,
strtotime
(
"
$week_start
+6 days"
));
return
array
(
"week_start"
=>
$week_start
,
"week_end"
=>
$week_end
);
}
}
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