24 #ifndef QORE_DATETIME_H
26 #define QORE_DATETIME_H
30 class AbstractQoreZoneInfo;
34 int year, month, day, hour, minute, second, us, utc_secs_east;
36 const char *zone_name;
37 const AbstractQoreZoneInfo *zone;
39 DLLLOCAL
void clear() {
53 DLLLOCAL
bool isTimeNull()
const {
54 return !hour && !minute && !second && !us;
90 class qore_date_private *
priv;
92 DLLLOCAL
void setDateLiteral(int64 date);
93 DLLLOCAL
void setRelativeDateLiteral(int64 date);
99 DLLLOCAL
DateTime(qore_date_private *n_priv);
119 DLLEXPORT
DateTime(
int n_year,
int n_month,
int n_day,
int n_hour = 0,
int n_minute = 0,
int n_second = 0,
short n_ms = 0,
bool n_relative =
false);
132 DLLEXPORT
DateTime(int64 seconds,
int ms);
137 DLLEXPORT
DateTime(
const char *date);
143 DLLEXPORT
DateTime(
const AbstractQoreZoneInfo *zone,
const char *date);
149 DLLEXPORT
DateTime(
const struct tm *tms);
158 DLLEXPORT
void getTM(
struct tm *tms)
const;
169 DLLEXPORT
void setNow(
const AbstractQoreZoneInfo *zone);
175 DLLEXPORT
void setDate(int64 seconds);
182 DLLEXPORT
void setDate(int64 seconds,
int ms);
189 DLLEXPORT
void setDate(
const AbstractQoreZoneInfo *zone, int64 seconds,
int us);
196 DLLEXPORT
void setLocalDate(
const AbstractQoreZoneInfo *zone, int64 seconds,
int us);
199 DLLEXPORT
void setDate(
const AbstractQoreZoneInfo *n_zone,
int n_year,
int n_month,
int n_day,
int n_hour = 0,
int n_minute = 0,
int n_second = 0,
int n_us = 0);
205 DLLEXPORT
void setDate(
const char *str);
212 DLLEXPORT
void setDate(
const AbstractQoreZoneInfo *zone,
const char *str);
218 DLLEXPORT
void setDate(
const struct tm *tms,
short ms = 0);
230 DLLEXPORT
void setTime(
int h,
int m,
int s,
short ms = 0);
232 DLLEXPORT
bool checkValidity()
const;
233 DLLEXPORT
bool isEqual(
const DateTime *dt)
const;
279 DLLEXPORT
void getISOWeek(
int &year,
int &week,
int &day)
const;
339 DLLEXPORT
short getYear()
const;
351 DLLEXPORT
int getDay()
const;
410 DLLEXPORT
void getInfo(
const AbstractQoreZoneInfo *n_zone,
qore_tm &info)
const;
416 DLLEXPORT
void setZone(
const AbstractQoreZoneInfo *n_zone);
419 DLLEXPORT
const AbstractQoreZoneInfo*
getZone()
const;
443 DLLEXPORT
static DateTime *
makeAbsolute(
const AbstractQoreZoneInfo *n_zone,
int n_year,
int n_month,
int n_day,
int n_hour = 0,
int n_minute = 0,
int n_second = 0,
int n_us = 0);
451 DLLEXPORT
static DateTime *
makeAbsolute(
const AbstractQoreZoneInfo *zone, int64 seconds,
int us = 0);
462 DLLEXPORT
static DateTime *
makeRelative(
int n_year,
int n_month,
int n_day,
int n_hour = 0,
int n_minute = 0,
int n_second = 0,
int n_us = 0);