Storing date to a database, retrieving it and displaying it
Posted: Sat Feb 27, 2016 7:39 pm
Hello
I want to store dates in an SQL database. A way to do it seems to be (for today's date):
and then to store the integer tDateAsSeconds in the database. My questions are:
1) When I add the line
then the output is empty (and not the integer coding the date). Why?
2) Please provide code to convert the tDateAsSeconds (for instance: after retrieving it back from the database) back to a date and to display it in a readable format via
3) Is there a way to store the date in a more consistent way - i.e. as days, not as seconds
4) If you know any other ways to store the date in a database, please share them
Thanks in advance
greg falda
I want to store dates in an SQL database. A way to do it seems to be (for today's date):
Code: Select all
put the date into tDate
convert tDate to seconds
put it into tDateAsSeconds
1) When I add the line
Code: Select all
answer tDateAsSeconds
2) Please provide code to convert the tDateAsSeconds (for instance: after retrieving it back from the database) back to a date and to display it in a readable format via
Code: Select all
answer ...
4) If you know any other ways to store the date in a database, please share them

Thanks in advance
greg falda