Please help with dates and other items...
Posted: Mon Sep 20, 2010 4:00 pm
Hi all,
I've had PureBasic for a while and have done a few things with it but am far from adequate with it, let alone proficient.
I'm working on an program to translate some downloaded tabular material from HTML to CSV format for integration into a database. This data is TV listing information and each file represents a three-hour span, providing program information for each of 100+ channels during that period.
I have a basic framework going but my first challenge seems to be working with dates. Each raw data file (again, HTML, but that doesn't matter for this question) is named something like "ZCGrid.do@fromTimeInMillis=1204023600000". I'd like to take that millisecond figure and convert it into a useable date, both for the output file and for the title inside the CSV file.
If I take the filename above as a string (sInFile) and perform "Right(sInFile, 13)" I get the string "1204023600000". But I'm not sure what to do with it. If I use the Val() function and try to put it into an integer the value changes (because the integer type isn't big enough I assume). If I use the ValD() function and put it into a double I see that the value is correct but that value then does not seem to work with the FormatDate function:
I can't find in the documentation what type the Date functions expect to be handed. Am I missing something. Any suggestions on how to make this work. I'm sure this is terribly n00bish and I'm just missing something painfully obvious here. Thanks for any help!
BTW, the vagueish title is because I'm assuming I'll run into other stuff and don't want to spam the forums with multiple threads...if that's the wrong concept for these forums please let me know.
M
I've had PureBasic for a while and have done a few things with it but am far from adequate with it, let alone proficient.

I have a basic framework going but my first challenge seems to be working with dates. Each raw data file (again, HTML, but that doesn't matter for this question) is named something like "ZCGrid.do@fromTimeInMillis=1204023600000". I'd like to take that millisecond figure and convert it into a useable date, both for the output file and for the title inside the CSV file.
If I take the filename above as a string (sInFile) and perform "Right(sInFile, 13)" I get the string "1204023600000". But I'm not sure what to do with it. If I use the Val() function and try to put it into an integer the value changes (because the integer type isn't big enough I assume). If I use the ValD() function and put it into a double I see that the value is correct but that value then does not seem to work with the FormatDate function:
Code: Select all
tmpa.d = ValD(Right(sInFile, 13))
tmpb.s = FormatDate("%yyyy-%mm-%dd %hh:%ii:%ss", tmpa)
BTW, the vagueish title is because I'm assuming I'll run into other stuff and don't want to spam the forums with multiple threads...if that's the wrong concept for these forums please let me know.

M