Reputation: 113
Is it possible to convert date to milliseconds? From below type(Table) when i want retrieve data of JoinDate column should show time in total Milliseconds.
Example 2010-10-12 13:10:10 (Time)==>1291966810000(Millisecond)
----------------------------------
|S.No | ID | JoinDate |
----------------------------------
| 1 | N107 | 2010-10-12 13:10:10 |
| | | |
| 2 | N108 | 2011-2-12 10:40:10 |
| | | |
| 3 | N109 | 2013-10-12 11:10:50 |
| | | |
------------------------------------
Upvotes: 0
Views: 8933
Reputation: 31
Also, you can use this
{
"query": {
"match_all": {}
},
"script_fields": {
"createddate": {
"lang": "painless",
"script": "doc['createddate'].value.millis"
}
}
}
Upvotes: 0
Reputation: 957
try something like
{
"query": {
"match_all": {}
},
"script_fields": {
"JoinDate": {
"script": "doc['JoinDate'].date.getMillis()"
}
}
}
Upvotes: 7