I need to convert a date into a date accepted by a restService.
I receive a date 2016-06-26
from a form and I want to convert it to call restService.
The restService accepts the format 2016-06-13T00:00:00+0200
.
I tried all format proposed by Date
in javascript ( toUTCString()
, toJson
, ...) but nothing works.
You can use momentjs
moment.utc([yyyy, mm, dd]).format();
please refer http://momentjs.com/docs/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.