35 int year, month, day, hour, minute;
61 sprintf(buf,
"%d", year);
64 sprintf(buf,
"%d%c%02d", year, ds, month);
67 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
70 sprintf(buf,
"%d%c%02d%c%02d %02d", year, ds, month, ds, day, hour);
73 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d", year, ds, month, ds, day,
78 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g", year, ds, month,
79 ds, day, hour, ts, minute, ts, xs, seconds);
86 sprintf(buf,
"%d", month);
89 sprintf(buf,
"%02d%c%02d", month, ds, day);
92 sprintf(buf,
"%02d%c%02d %02d", month, ds, day, hour);
95 sprintf(buf,
"%02d%c%02d %02d%c%02d", month, ds, day, hour, ts,
100 sprintf(buf,
"%02d%c%02d %02d%c%02d%c%s%.10g", month, ds, day, hour,
101 ts, minute, ts, xs, seconds);
108 sprintf(buf,
"%02d", day);
111 sprintf(buf,
"%02d %02d", day, hour);
114 sprintf(buf,
"%02d %02d%c%02d", day, hour, ts, minute);
118 sprintf(buf,
"%02d %02d%c%02d%c%s%.10g", day, hour, ts, minute, ts,
126 sprintf(buf,
"%02d", hour);
129 sprintf(buf,
"%02d%c%02d", hour, ts, minute);
133 sprintf(buf,
"%02d%c%02d%c%s%.10g", hour, ts, minute, ts, xs,
141 sprintf(buf,
"%02d", minute);
145 sprintf(buf,
"%02d%c%s%.10g", minute, ts, xs, seconds);
154 sprintf(buf,
"%g", seconds);
161 sprintf(buf,
"%d%c%02d%c%02d", year, ds, month, ds, day);
164 sprintf(buf,
"%02d%c%02d%c%s%.10g", hour, ts, minute, ts, xs,
168 sprintf(buf,
"%d%c%02d%c%02d %02d%c%02d%c%s%.10g", year, ds, month,
169 ds, day, hour, ts, minute, ts, xs, seconds);
200 int year, month, day, hour, minute;
203 year = month = day = 0;
217 sscanf(buf,
"%d", &year);
220 sscanf(buf,
"%d%*c%d", &year, &month);
223 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
226 sscanf(buf,
"%d%*c%d%*c%d %d", &year, &month, &day, &hour);
229 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d", &year, &month, &day, &hour,
234 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf", &year, &month, &day,
235 &hour, &minute, &seconds);
242 sscanf(buf,
"%d", &month);
245 sscanf(buf,
"%d%*c%d", &month, &day);
248 sscanf(buf,
"%d%*c%d %d", &month, &day, &hour);
251 sscanf(buf,
"%d%*c%d %d%*c%d", &month, &day, &hour, &minute);
255 sscanf(buf,
"%d%*c%d %d%*c%d%*c%lf", &month, &day, &hour, &minute,
263 sscanf(buf,
"%d", &day);
266 sscanf(buf,
"%d %d", &day, &hour);
269 sscanf(buf,
"%d %d%*c%d", &day, &hour, &minute);
273 sscanf(buf,
"%d %d%*c%d%*c%lf", &day, &hour, &minute, &seconds);
280 sscanf(buf,
"%d", &hour);
283 sscanf(buf,
"%d%*c%d", &hour, &minute);
287 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
294 sscanf(buf,
"%d", &minute);
298 sscanf(buf,
"%d%*c%lf", &minute, &seconds);
304 sscanf(buf,
"%lf", &seconds);
309 sscanf(buf,
"%d%*c%d%*c%d", &year, &month, &day);
312 sscanf(buf,
"%d%*c%d%*c%lf", &hour, &minute, &seconds);
315 sscanf(buf,
"%d%*c%d%*c%d %d%*c%d%*c%lf", &year, &month, &day,
316 &hour, &minute, &seconds);
int db_convert_value_datetime_into_string(dbValue *value, int sqltype, dbString *string)
Convert datetime value into string.
int db_convert_Cstring_to_value_datetime(const char *buf, int sqltype, dbValue *value)
Convert datetime string to value.
#define DB_SQL_TYPE_TIMESTAMP
int db_get_value_month(dbValue *)
Get month value.
void db_set_value_hour(dbValue *, int)
Set hour value.
int db_get_value_day(dbValue *)
Get day value.
void db_set_value_datetime_current(dbValue *)
Set datetime to current.
void db_set_value_year(dbValue *, int)
Set year value.
double db_get_value_seconds(dbValue *)
Get seconds value.
int db_get_value_year(dbValue *)
Get year value.
int db_set_string(dbString *, const char *)
Inserts string to dbString (enlarge string)
void db_set_value_minute(dbValue *, int)
Set minute value.
void db_set_value_seconds(dbValue *, double)
Set seconds value.
int db_get_value_hour(dbValue *)
Get hour value.
int db_get_value_minute(dbValue *)
Get minute value.
int db_nocase_compare(const char *, const char *)
Compare strings case-insensitive.
int db_test_value_datetime_current(dbValue *)
Check if datatime is current.
void db_set_value_day(dbValue *, int)
Set day value.
void db_set_value_month(dbValue *, int)
Set month value.
void db_interval_range(int, int *, int *)
Define range based on SQL data type.