0

Is there any direct datatype in eosio to store date? and if not then how can we store dates in eosio table?

void mainloan::paymentConfirm(uint64_t pay_id,uint64_t pay_date,double pay_amunt,name from ,uint64_t loan_id){ require_auth(_self);

payMade_table.emplace(get_self(),[&](auto &p){ p.pay_id=payMade_table.available_primary_key(); p.pay_date=pay_date; p.pay_amunt=pay_amunt; p.pay_from=from; p.loan_id=loan_id; });

1 Answer 1

1

Yes. You can either convert the data to a uint64_t as you have showed above, or you can use the time_point types:

time_point
time_point_sec
block_timestamp_type

I believe of the above, time_point_sec is likely most common. time_point_sec is a lower resolution timestamp accurate to seconds.

time_point_sec format:

yyyy-MM-dd T HH:mm:ssz

time_point format:

yyyy-MM-dd T HH:mm:ss.SSSSSSz

List of Available EOS Datatypes

2
  • can u please give a example for time_point Commented Aug 27, 2019 at 7:42
  • Edited the answer to include both Commented Aug 29, 2019 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.