Today is June 17. but when I execute my function and store the following arguments.

WriterModel(owner,postID, _postContent, now);

"now", It returns the July 20 timestamp.

It perfectly working fine in remix IDE which returns the today timestamp but in my local (Angular+Truffle + smart contract ) it returns July 20.

Can you please give me where I were Wrong.?

  • Are you using Ganache, Rinkeby...? – alberto Jun 17 '19 at 18:17
  • I am using Ganache – Suria Jun 18 '19 at 2:02
  • @Suria Check the computer clock in your pc is synchronized. Remember the timestamp returned is the unix time so it is in UTC. – Ismael Jun 18 '19 at 20:51
  • 1
    @Ismael , I have checked again there is no difference in my pc date and if it is UTC then the difference is just 5.30 hrs right ? – Suria Jun 19 '19 at 0:55
  • @phant0m can your please tell the other possibilities of storing time with that record ? – Suria Jun 19 '19 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.