javascript - How to convert Unix Timestamp to date with GMT (IST) format using moment in AngularJs -


    test:{"a":"\/date(1442773800000+0530)\/","b":"423"} 

hi getting big trouble,above data (json format), here using momentjs convert unix time stamp date , time without using + 530 code, sometime date not showing correct format, automatically convert different utc/gmt (time zone),

 moment(test.a).format('dd-mm-yyyy  hh:mm') 

how use including gmt(+530) in moment script

utcoffset() preferred method of moment 2.9.0. function uses real offset utc, not reverse offset.

moment(1369266934311).utcoffset(+530).format('yyyy-mm-dd hh:mm') 

and if using moment version less 2.9. can go :

moment(1369266934311).zone(+530).format('yyyy-mm-dd hh:mm') 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -