Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-resource-management
Project
Project
Details
Activity
Releases
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
project-open
intranet-resource-management
Commits
206fc1a1
Commit
206fc1a1
authored
Jun 15, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Removing trailing zeros from several date components
parent
dc4a584b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
intranet-resource-management-procs.tcl
tcl/intranet-resource-management-procs.tcl
+8
-6
No files found.
tcl/intranet-resource-management-procs.tcl
View file @
206fc1a1
...
...
@@ -246,17 +246,19 @@ ad_proc -public im_date_julian_to_components { julian_date } {
set ansi
[
dt_julian_to_ansi
$julian
_date
]
regexp
{(
....
)
-
(
..
)
-
(
..
)}
$ansi
match year month_of_year day_of_month
# Trim zero for months JAN-SEPT
if
{
$month
_of_year < 10
}
{
set month_of_year
[
string
trim
$month
_of_year 0
]}
set first_year_julian
[
dt_ansi_to_julian
$year
1 1
]
set day_of_year
[
expr
{
$julian
_date -
$first
_year_julian + 1
}]
set quarter_of_year
[
expr
{
1 + int
((
$month
_of_year-1
)
/ 3
)}]
set week_of_year
[
util_memoize
[
list
db_string dow
"select to_char(to_date('
$julian
_date', 'J'),'IW')"
]]
set day_of_week
[
util_memoize
[
list
db_string dow
"select extract(dow from to_date('
$julian
_date', 'J'))"
]]
if
{
0 ==
$day
_of_week
}
{
set day_of_week 7
}
# Trim zeros
if
{
"0"
eq
[
string
range
$month
_of_year 0 0
]}
{
set month_of_year
[
string
range
$month
_of_year 1 end
]
}
if
{
"0"
eq
[
string
range
$week
_of_year 0 0
]}
{
set week_of_year
[
string
range
$week
_of_year 1 end
]
}
if
{
"0"
eq
[
string
range
$day
_of_month 0 0
]}
{
set day_of_month
[
string
range
$day
_of_month 1 end
]
}
set quarter_of_year
[
expr
{
1 + int
((
$month
_of_year-1
)
/ 3
)}]
return
[
list
year
$year
\
month_of_year
$month
_of_year
\
day_of_month
$day
_of_month
\
...
...
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