I want only the first part of a unix timestamp in this format
1714197412.2837634I want only the numbers before the ".", or just 1714197412.
My script is importing "time" and I try this first:
print(int(time.time()))which gives me the expected
1714197412However when calling the function within my construction of a json payload like this:
def setpayload_bids_single(hps_id, pp_id):myjson = {"hpsId": hps_id,"powerPlantId": pp_id,"readPeriod": [ int(time.time()), 1714132800 ],"timeAxis": {"t0": int(time.time()),"dt": 900,"n": 200 }}return myjsonit complains that it has to be a string.
Changing to
print(str(time.time()))results in the "longer" string
1714197412.2837634How can I chop of everything after, and including the "." using the str function?