Bitcoin Forum
May 05, 2024, 06:29:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: time field on a transaction using javascript  (Read 613 times)
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 24, 2014, 12:43:41 AM
 #1

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 Smiley
1714890578
Hero Member
*
Offline Offline

Posts: 1714890578

View Profile Personal Message (Offline)

Ignore
1714890578
Reply with quote  #2

1714890578
Report to moderator
1714890578
Hero Member
*
Offline Offline

Posts: 1714890578

View Profile Personal Message (Offline)

Ignore
1714890578
Reply with quote  #2

1714890578
Report to moderator
1714890578
Hero Member
*
Offline Offline

Posts: 1714890578

View Profile Personal Message (Offline)

Ignore
1714890578
Reply with quote  #2

1714890578
Report to moderator
Unlike traditional banking where clients have only a few account numbers, with Bitcoin people can create an unlimited number of accounts (addresses). This can be used to easily track payments, and it improves anonymity.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
eb3full
VIP
Full Member
*
Offline Offline

Activity: 198
Merit: 101


View Profile
May 24, 2014, 01:20:33 AM
 #2

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()

"With four parameters I can fit an elephant, and with five I can make him wiggle his trunk." John von Neumann
buy me beer: 1HG9cBBYME4HUVhfAqQvW9Vqwh3PLioHcU
Endlessa (OP)
Sr. Member
****
Offline Offline

Activity: 335
Merit: 250


View Profile
May 24, 2014, 03:37:08 AM
 #3

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 Smiley ty Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!