xxxxxxxxxx
import datetime
def convert_seconds_to_date(seconds):
# Assuming seconds as input
# Convert seconds to datetime object
date_obj = datetime.datetime.fromtimestamp(seconds)
# Format the datetime object as string
date_str = date_obj.strftime("%Y-%m-%d %H:%M:%S")
return date_str
# Example usage:
secs = 1634648836
result = convert_seconds_to_date(secs)
print(result)
xxxxxxxxxx
/// the current time, in “seconds since the epoch”
static int currentTimeInSeconds() {
var ms = (new DateTime.now()).millisecondsSinceEpoch;
return (ms / 1000).round();
}