• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 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 45 of file datetime.cpp.

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

Constructor for a date-only value.

Definition at line 50 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 55 of file datetime.cpp.

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

Constructor for a date-time value.

Definition at line 60 of file datetime.cpp.

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

Constructor for a date-time value.

Definition at line 65 of file datetime.cpp.

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

Copy constructor.

Definition at line 70 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 291 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 286 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 296 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 281 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 301 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 170 of file datetime.cpp.

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

Compare this value with another.

Definition at line 352 of file datetime.cpp.

QDate KAlarmCal::DateTime::date ( ) const

Returns the date part of the value.

Definition at line 113 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 306 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 143 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 159 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 133 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 342 of file datetime.cpp.

bool KAlarmCal::DateTime::isClockTime ( ) const

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

Definition at line 206 of file datetime.cpp.

bool KAlarmCal::DateTime::isDateOnly ( ) const

Returns true if it is date-only value.

Definition at line 103 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 201 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 93 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 216 of file datetime.cpp.

bool KAlarmCal::DateTime::isSecondOccurrence ( ) const

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

Definition at line 226 of file datetime.cpp.

bool KAlarmCal::DateTime::isUtc ( ) const

Returns whether the date/time is a UTC time.

Definition at line 211 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 98 of file datetime.cpp.

KDateTime KAlarmCal::DateTime::kDateTime ( ) const

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

Definition at line 128 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 311 of file datetime.cpp.

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

Assignment operator.

Definition at line 80 of file datetime.cpp.

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

Assignment operator.

Sets the value to a specified date-time.

Definition at line 87 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 123 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 316 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 321 of file datetime.cpp.

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

Sets the date component of the value.

Definition at line 118 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 108 of file datetime.cpp.

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

Sets the date/time component of the value.

Definition at line 154 of file datetime.cpp.

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

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

Definition at line 231 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 347 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 138 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 276 of file datetime.cpp.

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

Changes the time specification of the value.

Definition at line 191 of file datetime.cpp.

QTime KAlarmCal::DateTime::startOfDay ( )
static

Returns the start-of-day time.

Definition at line 357 of file datetime.cpp.

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

Returns the time specification of the value.

Definition at line 186 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 196 of file datetime.cpp.

KTimeZone KAlarmCal::DateTime::timeZone ( ) const

Returns the time zone of the value.

Definition at line 181 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toClockTime ( ) const

Returns the time converted to the local clock time.

Definition at line 256 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toLocalZone ( ) const

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

Definition at line 251 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 241 of file datetime.cpp.

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

Returns the time expressed as a specified offset from UTC.

Definition at line 246 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 326 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 334 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 271 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 266 of file datetime.cpp.

DateTime KAlarmCal::DateTime::toUtc ( ) const

Returns the time converted to UTC.

Definition at line 236 of file datetime.cpp.

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

Returns the time converted to a specified time zone.

Definition at line 261 of file datetime.cpp.

int KAlarmCal::DateTime::utcOffset ( ) const

Returns the UTC offset associated with the date/time.

Definition at line 221 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 372 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 362 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-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:30:15 by doxygen 1.8.3.1 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-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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