javascript - Moment js split time string -


am using moment js current time. based on time need execute search operation in elastic search database.

my database entry way :

"message_date": "2014-03-20t09:17:40.482z" 

moment code current time way :

var m = moment(); var testresult = m.tojson();  // outputs : 2014-03-20t09:17:40.482z 

my problem don't want include seconds filed in database query. want search minute field i.e 2014-03-20t09:17. can split moment date expected format. know not way that. please me expected time format in moment js way.

try:

var testresult = m.format('yyyy-mm-dd[t]hh:mm'); 

if want time in particular timezone:

var m = moment().zone("+05:30"); var testresult = m.format('yyyy-mm-dd[t]hh:mm'); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -