Timeline for converting "now" to "day"?
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 24, 2019 at 8:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jul 11, 2018 at 2:53 | answer | added | vhie | timeline score: 1 | |
Jul 10, 2018 at 13:49 | comment | added | Briomkez |
If you take a look to the solidity documentation media.readthedocs.org/pdf/solidity/develop/solidity.pdf Section 7.4.4 (Time Units), it shows some examples. If you use as convention 30 days you could for instance write expiryDate = now() + dayToWait*1 days , so that afterwards you can compare expiryDate and now directly. Maybe if you want to spare a multiplication in solidity and the related gas cost it is better the @goodvibration 's approach ^^
|
|
Jul 10, 2018 at 10:28 | comment | added | goodvibration |
The global unit now specifies the number of seconds elapsed since 1/1/1970. Therefore, you should pass the duration in seconds. It cannot be done accurately for one month, because this period of time is not defined accurately (i.e., it can be anything between 28 - 31 days). If you're OK with the approximation of one month as 30 days, then you can use 60 * 60 * 24 * 30 .
|
|
Jul 10, 2018 at 10:09 | history | asked | Questioner | CC BY-SA 4.0 |