#1 by otree
Hi all,
I would like to store the date and time (hour, minutes and seconds) in certain pages.
I use the code below and like this I can store the date and time in float format.
How can I store the date and time in actual date and time format (string variable)?
This is my code:
In models:
currentTime = models.FloatField()
In html:
<input type="hidden" name="currentTime" id="id_currentTime"/>
<script>
function record_current_time(){
var current_time = new Date();
current_time = current_time.getTime()
document.getElementById("id_currentTime").setAttribute("value", current_time)
}
window.onload = function() {
record_current_time();
}
</script>
Thanks so much in advance for your help! :)
#2 by Jonas
Hey, simply use a StringField instead of a FloatField ;)