I have a small database that I want to read, select certain records, and create a text file with them. Each one contains a date field and it is of the Unix Time format - number of seconds from Jan 1, 1970. I am have a horrible time trying to get that date out of the database and into a text format. I thought I had done this at one time a few weeks ago, but due to pilot error I managed to loose my source code and am now trying to re-create it. Can someone give me a few pointers on how to deal with these date fields?
Guys - I guess I didn’t explain it correctly. The database I’m working with has the date stored as a number of seconds from 1/1/1970. I need to convert that to a yyyy.mm.dd format.
I FIGURED IT OUT. I was overthinking it, I believe. All I needed to do was to do thus:
Dim mySeconds as Double
mySeconds=rows.Field(“dbTime”).DoubleValue
dim myDate as new Date(mySeconds, timezone.Current)
The variable myDate now contains the whole shebang - years, months, days, hours, etc…
Dave, almost, but not quite. The big flaw in what I was doing was not defining my DB field as Double. The documentation examples were helpful, but the light bulb didnt go on until I realized that the DB field was a Double, and not a date. My bad. I kept getting hung up trying to call things Xojo.Code.Date when I didnt need to. Anyway, I have what I need.