Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
T
topjs3-demos
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leon Li
topjs3-demos
Commits
dda0a0d8
Commit
dda0a0d8
authored
Jan 03, 2020
by
Leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload.
parent
61635c25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
time-toString.js
src/time-toString.js
+50
-0
No files found.
src/time-toString.js
0 → 100644
View file @
dda0a0d8
// 2020-01-02
// 王泽生Kurri 10:27:23
// topjs3 从数据库取字段类型是TIME的数据时,取到的是一个Object,如果用_.toString() 会得到一个空map,但是直接print或者用原生的String得到的就会使时间字符串,这个是啥原因啊?
// 王泽生Kurri 10:27:43
// Date类型的字段就没问题
var
db
=
require
(
'topsin.database'
)
var
_
=
require
(
'lodash'
)
require
(
'topsin.error'
)
db
.
addConnection
({
database_type
:
'pg'
,
database_host
:
'139.196.104.13:5433'
,
database_name
:
'TOPMES6_SEC_PMO_V6'
,
database_user
:
'toplinker'
,
database_pwd
:
'TopLinker0510'
},
"SEC"
);
var
query
=
db
.
query
(
'SEC'
);
var
data
=
query
.
selectMap
({
table
:
'sec_production_order_confirmation'
,
field
:
'posting_date,confirmation_entry_time'
,
where
:
{
id
:
[
4
,
5
]
}
})
db
.
removeConnection
(
"SEC"
);
var
date1
=
data
.
posting_date
var
time1
=
data
.
confirmation_entry_time
print
(
typeof
(
date1
))
// string
print
(
date1
)
// 2019-07-22
print
(
String
(
date1
))
// 2019-07-22
print
(
JSON
.
stringify
(
date1
))
// "2019-07-22"
print
(
_
.
toString
(
date1
))
// 2019-07-22
print
(
date1
.
toString
())
// 2019-07-22
print
(
date1
.
valueOf
())
// 2019-07-22
print
(
'-------------------------'
)
print
(
typeof
(
time1
))
// object
print
(
Object
.
getOwnPropertyNames
(
time1
))
// object
print
(
time1
)
// 16:28:36
print
(
String
(
time1
))
// 16:28:36
print
(
JSON
.
stringify
(
time1
))
// {}
print
(
_
.
toString
(
time1
))
// {}
print
(
time1
.
toString
())
// 16:28:36
print
(
time1
.
valueOf
())
// 16:28:36
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