Hi, I hope this question is not off-topic for this list.
I'm recieveing, occasionally, a .csv file from a source which I need to
process accordcing to some criteria and either insert, delet or update
it's rows into a database. One of it's criterias is date comparison.
In other words, proceeding differently when the date/time mentioned on a
specific row is a past date or future date comparing with the current
date/time.
My problem is the format in which I recieve the date and time:
"HH:MM:SS, YYYY--mm-dd".
This means separate fileds, one for time and one for date.
If the format was: "YYYY-mm-dd HH:MM:SS", I could call strptime to stor
this in a struct tm, then cakk mktime to get this in a time_t varialbe
and then call difftime with the current date/time to make the comparison
(I'm using C as programmikng language on Linux).
So, my question is: should I unify the 2 strings into one to obtain the
second format and then proceed as I explained above, or is there a way
to compare the date with the current date separately and the time with
the current time separately in case the dates are equal?
If the conclusion will be to uify the strings into one, should I create
a table with a single date/time column or still keep the 2 fileds
separately in my sql table?
Thanks, Rafi.

Reply via email to