• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KAlarm Library

  • KAlarmCal
  • DateTime
Public Member Functions | Static Public Member Functions | Friends | List of all members
KAlarmCal::DateTime Class Reference

#include <datetime.h>

Public Member Functions

 DateTime ()
 
 DateTime (const QDate &d, const KDateTime::Spec &spec)
 
 DateTime (const QDate &d, const QTime &t, const KDateTime::Spec &spec)
 
 DateTime (const QDateTime &dt, const KDateTime::Spec &spec)
 
 DateTime (const KDateTime &dt)
 
 DateTime (const DateTime &dt)
 
DateTime addDays (int n) const
 
DateTime addMins (qint64 n) const
 
DateTime addMonths (int n) const
 
DateTime addSecs (qint64 n) const
 
DateTime addYears (int n) const
 
KDateTime calendarKDateTime () const
 
KDateTime::Comparison compare (const DateTime &other) const
 
QDate date () const
 
int daysTo (const DateTime &dt) const
 
QDateTime effectiveDateTime () const
 
KDateTime effectiveKDateTime () const
 
QTime effectiveTime () const
 
QString formatLocale (bool shortFormat=true) const
 
bool isClockTime () const
 
bool isDateOnly () const
 
bool isLocalZone () const
 
bool isNull () const
 
bool isOffsetFromUtc () const
 
bool isSecondOccurrence () const
 
bool isUtc () const
 
bool isValid () const
 
KDateTime kDateTime () const
 
int minsTo (const DateTime &dt) const
 
DateTime & operator= (const DateTime &dt)
 
DateTime & operator= (const KDateTime &dt)
 
QDateTime rawDateTime () const
 
int secsTo (const DateTime &dt) const
 
qint64 secsTo_long (const DateTime &dt) const
 
void setDate (const QDate &d)
 
void setDateOnly (bool d)
 
void setDateTime (const QDateTime &dt)
 
void setSecondOccurrence (bool second)
 
void setTime (const QTime &t)
 
void setTime_t (uint secs)
 
void setTimeSpec (const KDateTime::Spec &spec)
 
KDateTime::Spec timeSpec () const
 
KDateTime::SpecType timeType () const
 
KTimeZone timeZone () const
 
DateTime toClockTime () const
 
DateTime toLocalZone () const
 
DateTime toOffsetFromUtc () const
 
DateTime toOffsetFromUtc (int utcOffset) const
 
QString toString (Qt::DateFormat f=Qt::TextDate) const
 
QString toString (const QString &format) const
 
uint toTime_t () const
 
DateTime toTimeSpec (const KDateTime::Spec &spec) const
 
DateTime toUtc () const
 
DateTime toZone (const KTimeZone &zone) const
 
int utcOffset () const
 

Static Public Member Functions

static void setStartOfDay (const QTime &sod)
 
static QTime startOfDay ()
 

Friends

KALARMCAL_EXPORT friend bool operator< (const KAlarmCal::DateTime &dt1, const KAlarmCal::DateTime &dt2)
 
bool operator< (const KDateTime &dt1, const KAlarmCal::DateTime &dt2)
 
KALARMCAL_EXPORT friend bool operator== (const KAlarmCal::DateTime &dt1, const KAlarmCal::DateTime &dt2)
 
KALARMCAL_EXPORT friend bool operator== (const KDateTime &dt1, const KAlarmCal::DateTime &dt2)
 

Detailed Description

As KDateTime, but with a configurable start-of-day time for date-only values.

The DateTime class holds a date, with or without a time.

DateTime is very similar to the KDateTime class. The time assumed for date-only values is the start-of-day time set by setStartOfDay().

Author
David Jarvie djarv.nosp@m.ie@k.nosp@m.de.or.nosp@m.g

Definition at line 42 of file datetime.h.

Constructor & Destructor Documentation

KAlarmCal::DateTime::DateTime ( )

Default constructor.

Constructs an invalid date-time.

Definition at line 49 of file datetime.cpp.

KAlarmCal::DateTime::DateTime ( const QDate &  d,
const KDateTime::Spec &  spec 
)

Constructor for a date-only value.

Definition at line 54 of file datetime.cpp.

KAlarmCal::DateTime::DateTime ( const QDate &  d,
const QTime &  t,
const KDateTime::Spec &  spec 
)

Constructor for a date-time value.

Definition at line 59 of file datetime.cpp.

KAlarmCal::DateTime::DateTime ( const QDateTime &  dt,
const KDateTime::Spec &  spec 
)

Constructor for a date-time value.

Definition at line 64 of file datetime.cpp.

KAlarmCal::DateTime::DateTime ( const KDateTime &  dt)

Constructor for a date-time value.

Definition at line 69 of file datetime.cpp.

KAlarmCal::DateTime::DateTime ( const DateTime &  dt)

Copy constructor.

Definition at line 74 of file datetime.cpp.

Member Function Documentation

DateTime KAlarmCal::DateTime::addDays ( int  n) const

Returns a DateTime value n days later than the value of this object.

Definition at line 295 of file datetime.cpp.

DateTime KAlarmCal::DateTime::addMins ( qint64  n) const

Returns a DateTime value mins minutes later than the value of this object.

Definition at line 290 of file datetime.cpp.

DateTime KAlarmCal::DateTime::addMonths ( int  n) const

Returns a DateTime value n months later than the value of this object.

Definition at line 300 of file datetime.cpp.

DateTime KAlarmCal::DateTime::addSecs ( qint64  n) const

Returns a DateTime value secs seconds later than the value of this object.

Definition at line 285 of file datetime.cpp.

DateTime KAlarmCal::DateTime::addYears ( int  n) const

Returns a DateTime value n years later than the value of this object.

Definition at line 305 of file datetime.cpp.

KDateTime KAlarmCal::DateTime::calendarKDateTime ( ) const

Returns the date and time of the value as written in the calendar.

If the value is date-only, the time part returned is 00:00.

Definition at line 174 of file datetime.cpp.

KDateTime::Comparison KAlarmCal::DateTime::compare ( const DateTime &  other) const

Compare this value with another.

Definition at line 356 of file datetime.cpp.

QDate KAlarmCal::DateTime::date ( ) const

Returns the date part of the value.

Definition at line 117 of file datetime.cpp.

int KAlarmCal::DateTime::daysTo ( const DateTime &  dt) const

Returns the number of days from this date or date-time to dt.

Definition at line 310 of file datetime.cpp.

QDateTime KAlarmCal::DateTime::effectiveDateTime ( ) const

Returns the date and time of the value.

If the value is date-only, the time part returned is equal to the start-of-day time set by setStartOfDay().

Definition at line 147 of file datetime.cpp.

KDateTime KAlarmCal::DateTime::effectiveKDateTime ( ) const

Returns the date and time of the value.

If the value is date-only, the time part returned is equal to the start-of-day time set by setStartOfDay().

Definition at line 163 of file datetime.cpp.

QTime KAlarmCal::DateTime::effectiveTime ( ) const

Returns the time part of the value.

If the value is date-only, the time returned is the start-of-day time set by setStartOfDay().

Definition at line 137 of file datetime.cpp.

QString KAlarmCal::DateTime::formatLocale ( bool  shortFormat = true) const

Returns the value as a string, formatted according to the user's locale.

If it is a date-time, both time and date are included in the output. If it is date-only, only the date is included in the output.

Definition at line 346 of file datetime.cpp.

bool KAlarmCal::DateTime::isClockTime ( ) const

Returns whether the date/time is a local clock time.

Definition at line 210 of file datetime.cpp.

bool KAlarmCal::DateTime::isDateOnly ( ) const

Returns true if it is date-only value.

Definition at line 107 of file datetime.cpp.

bool KAlarmCal::DateTime::isLocalZone ( ) const

Returns whether the time zone for the date/time is the current local system time zone.

Definition at line 205 of file datetime.cpp.

bool KAlarmCal::DateTime::isNull ( ) const

Returns true if the date is null and, if it is a date-time value, the time is also null.

Definition at line 97 of file datetime.cpp.

bool KAlarmCal::DateTime::isOffsetFromUtc ( ) const

Returns whether the date/time is a local time at a fixed offset from UTC.

Definition at line 220 of file datetime.cpp.

bool KAlarmCal::DateTime::isSecondOccurrence ( ) const

Returns whether the date/time is the second occurrence of this time.

Definition at line 230 of file datetime.cpp.

bool KAlarmCal::DateTime::isUtc ( ) const

Returns whether the date/time is a UTC time.

Definition at line 215 of file datetime.cpp.

bool KAlarmCal::DateTime::isValid ( ) const

Returns true if the date is valid and, if it is a date-time value, the time is also valid.

Definition at line 102 of file datetime.cpp.

KDateTime KAlarmCal::DateTime::kDateTime ( ) const

Returns the date and time of the value as a KDateTime.

Definition at line 132 of file datetime.cpp.

int KAlarmCal::DateTime::minsTo ( const DateTime &  dt) const

Returns the number of minutes from this date or date-time to dt.

Definition at line 315 of file datetime.cpp.

DateTime & KAlarmCal::DateTime::operator= ( const DateTime &  dt)

Assignment operator.

Definition at line 84 of file datetime.cpp.

DateTime & KAlarmCal::DateTime::operator= ( const KDateTime &  dt)

Assignment operator.

Sets the value to a specified date-time.

Definition at line 91 of file datetime.cpp.

QDateTime KAlarmCal::DateTime::rawDateTime ( ) const

Returns the date and time of the value.

If the value is date-only, the time part returned is 00:00:00.

Definition at line 127 of file datetime.cpp.

int KAlarmCal::DateTime::secsTo ( const DateTime &  dt) const

Returns the number of seconds from this date or date-time to dt.

Warning
The return value can overflow if the two values are far enough apart. Use sectTo_long() to avoid this.

Definition at line 320 of file datetime.cpp.

qint64 KAlarmCal::DateTime::secsTo_long ( const DateTime &  dt) const

Returns the number of seconds as a qint64 from this date or date-time to dt.

Definition at line 325 of file datetime.cpp.

void KAlarmCal::DateTime::setDate ( const QDate &  d)

Sets the date component of the value.

Definition at line 122 of file datetime.cpp.

void KAlarmCal::DateTime::setDateOnly ( bool  d)

Sets the value to be either date-only or date-time.

Parameters
dTrue to set the value to be date-only; false to set it to a date-time value.

Definition at line 112 of file datetime.cpp.

void KAlarmCal::DateTime::setDateTime ( const QDateTime &  dt)

Sets the date/time component of the value.

Definition at line 158 of file datetime.cpp.

void KAlarmCal::DateTime::setSecondOccurrence ( bool  second)

Sets whether this is the second occurrence of this date/time.

Definition at line 235 of file datetime.cpp.

void KAlarmCal::DateTime::setStartOfDay ( const QTime &  sod)
static

Sets the start-of-day time.

The default value is midnight (0000 hrs).

Definition at line 351 of file datetime.cpp.

void KAlarmCal::DateTime::setTime ( const QTime &  t)

Sets the time component of the value.

The value is converted if necessary to be a date-time value.

Definition at line 142 of file datetime.cpp.

void KAlarmCal::DateTime::setTime_t ( uint  secs)

Sets the value to a specified date-time value.

Parameters
secsThe time_t date-time value, expressed as the number of seconds elapsed since 1970-01-01 00:00:00 UTC.

Definition at line 280 of file datetime.cpp.

void KAlarmCal::DateTime::setTimeSpec ( const KDateTime::Spec &  spec)

Changes the time specification of the value.

Definition at line 195 of file datetime.cpp.

QTime KAlarmCal::DateTime::startOfDay ( )
static

Returns the start-of-day time.

Definition at line 361 of file datetime.cpp.

KDateTime::Spec KAlarmCal::DateTime::timeSpec ( ) const

Returns the time specification of the value.

Definition at line 190 of file datetime.cpp.

KDateTime::SpecType KAlarmCal::DateTime::timeType ( ) const

Returns the time specification type of the date/time, i.e.

whether it is UTC, has a time zone, etc.

Definition at line 200 of file datetime.cpp.

KTimeZone KAlarmCal::DateTime::timeZone ( ) const

Returns the time zone of the value.

Definition at line 185 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toClockTime ( ) const

Returns the time converted to the local clock time.

Definition at line 260 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toLocalZone ( ) const

Returns the time converted to the current local system time zone.

Definition at line 255 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toOffsetFromUtc ( ) const

Returns the time expressed as an offset from UTC, using the UTC offset associated with this instance's date/time.

Definition at line 245 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toOffsetFromUtc ( int  utcOffset) const

Returns the time expressed as a specified offset from UTC.

Definition at line 250 of file datetime.cpp.

QString KAlarmCal::DateTime::toString ( Qt::DateFormat  f = Qt::TextDate) const

Returns the value as a string.

If it is a date-time, both time and date are included in the output. If it is date-only, only the date is included in the output.

Definition at line 330 of file datetime.cpp.

QString KAlarmCal::DateTime::toString ( const QString &  format) const

Returns the value as a string.

If it is a date-time, both time and date are included in the output. If it is date-only, only the date is included in the output.

Definition at line 338 of file datetime.cpp.

uint KAlarmCal::DateTime::toTime_t ( ) const

Converts the time to a UTC time, measured in seconds since 00:00:00 UTC 1st January 1970 (as returned by time(2)).

Definition at line 275 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toTimeSpec ( const KDateTime::Spec &  spec) const

Returns the time converted to a new time specification.

Definition at line 270 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toUtc ( ) const

Returns the time converted to UTC.

Definition at line 240 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toZone ( const KTimeZone &  zone) const

Returns the time converted to a specified time zone.

Definition at line 265 of file datetime.cpp.

int KAlarmCal::DateTime::utcOffset ( ) const

Returns the UTC offset associated with the date/time.

Definition at line 225 of file datetime.cpp.

Friends And Related Function Documentation

KALARMCAL_EXPORT friend bool operator< ( const KAlarmCal::DateTime &  dt1,
const KAlarmCal::DateTime &  dt2 
)
friend

Returns true if the dt1 is earlier than dt2.

If the two values have the same date, and one value is date-only while the other is a date-time, the time used for the date-only value is the start-of-day time set in the KAlarm Preferences dialog.

Definition at line 376 of file datetime.cpp.

KALARMCAL_EXPORT friend bool operator== ( const KAlarmCal::DateTime &  dt1,
const KAlarmCal::DateTime &  dt2 
)
friend

Returns true if the two values are equal.

Definition at line 366 of file datetime.cpp.


The documentation for this class was generated from the following files:
  • datetime.h
  • datetime.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KAlarm Library

Skip menu "KAlarm Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal