Title: time field on a transaction using javascript Post by: Endlessa on May 24, 2014, 12:43:41 AM I'm certain this is a facepalm moment, but I'm trying to convert the json time field on a transaction using javascript and can't figure out wtf I'm doing wrong. .. fml moment
new Date(objectTransaction.time).toUTCString() returns a date in 1970, obviously this is not correct please help :) Title: Re: time field on a transaction using javascript Post by: eb3full on May 24, 2014, 01:20:33 AM Is objectTransaction.time a unix timestamp? The Date constructor requires timestamps in milliseconds, so you need to do:
Code: new Date(objectTransaction.time * 1000).toUTCString() Title: Re: time field on a transaction using javascript Post by: Endlessa on May 24, 2014, 03:37:08 AM Is objectTransaction.time a unix timestamp? The Date constructor requires timestamps in milliseconds, so you need to do: Code: new Date(objectTransaction.time * 1000).toUTCString() lol I knew it was something stupid :) ty :) |