DateTime.h
declares the API that this chapter describes. For more information on the time manager, see the section "Time" in the Palm OS Programmer's Companion.
typedef enum
    {
    tfColon,
    tfColonAMPM, // 1:00 pm
    tfColon24h, // 13:00
    tfDot,
    tfDotAMPM, // 1.00 pm
    tfDot24h, // 13.00
    tfHoursAMPM, // 1 pm
    tfHours24h, // 13
    tfComma24h // 13,00
    } TimeFormatType;
typedef TimeFormatType* TimeFormatPtr;
typedef enum {
    dsNone, //Daylight Savings Time not
//observed
    dsUSA, //United States Daylight
//Savings Time
    dsAustralia, //Australian Daylight
//Savings Time
    dsWesternEuropean, //Western European Daylight
//Savings Time
    dsMiddleEuropean, //Middle European Daylight
//Savings Time
    dsEasternEuropean, //Eastern European Daylight
//Savings Time
    dsGreatBritain, //Great Britain and Eire
//Daylight Savings Time
    dsRumania, //Rumanian Daylight Savings
//Time
    dsTurkey, //Turkish Daylight Savings
//Time
    dsAustraliaShifted //Australian Daylight
//Savings Time with shift
//in 1986
} DaylightSavingsTypes;
typedef enum {
    dfMDYWithSlashes, // 12/31/95
    dfDMYWithSlashes, // 31/12/95
    dfDMYWithDots, // 31.12.95
    dfDMYWithDashes, // 31-12-95
    dfYMDWithSlashes, // 95/12/31
    dfYMDWithDots, // 95.12.31
    dfYMDWithDashes, // 95-12-31
    dfMDYLongWithComma, // Dec 31, 1995
    dfDMYLong, // 31 Dec 1995
    dfDMYLongWithDot, // 31. Dec 1995
    dfDMYLongNoDay, // Dec 1995
    dfDMYLongWithComma, // 31 Dec, 1995
    dfYMDLongWithDot, // 1995.12.31
    dfYMDLongWithSpace, // 1995 Dec 31
    dfMYMed, // Dec '95
    dfMYMedNoPost // Dec 95
//added for French 2.0 ROM)
    } DateFormatType;
typedef struct{
Int16 second;
Int16 minute;
Int16 hour;
Int16 day;
Int16 month;
Int16 year;
Int16 weekDay ; //Days since Sunday (0 to 6)
}DateTimeType;
typedef DateTimeType * DateTimePtr;
typedef struct {
UInt8 hours;
UInt8 minutes;
}TimeType;
typedef TimeType * TimePtr;
typedef struct{
UInt16 year :7 ; //years since 1904 (Mac format)
UInt16 month :4;
UInt16 day :5;
}DateType;
typedef DateType * DatePtr;
void DateAdjust (DatePtr dateP, Int32 adjustment)
  |
|
A "DateType" structure with the date to be adjusted (see DateTime.h ). |
  |
|
The adjustment in number of days. |
dateP
to contain the new date.
void DateDaysToDate (UInt32 days, DatePtr date)
  |
|
Days since 1/1/1904. |
  |
|
Pointer to "DateType" structure (returned). |
date.
TimAdjust
,
DateToDays
void DateSecondsToDate (UInt32 seconds, DatePtr date)
  |
|
Seconds since 1/1/1904. |
  |
|
Pointer to "DateType" structure (returned). |
date.
templateP
string.
UInt16 DateTemplateToAscii(const Char *templateP, UInt8 months, UInt8 days, UInt16 years, Char *stringP, Int16 stringLen)
templateP
pointer to template string used to format date. Max length is maxDateTemplateLen
bytes, excluding the terminating null.
months
months (1-12)
days
days (1-31)
years
years. For example, 1995.
stringP
pointer to string which gets the result. Up to stringLen
bytes (excluding the terminating null byte.) Can be NULL, in which case the required string length is still returned by the function. If not NULL, then the formatted string is written to it,
stringLen
size of string buffer, excluding the terminating NULL byte.
stringP
parameter is null.
stringP
parameter can be NULL, in which case the required string length is still returned.
NOTE:  This routine is only available in PalmOS 3.5 or later ROMs.
templateP
, and creates a properly formatted date string in stringP
for the values passed in months
, days
, and years
.
#define dateTemplateShortModifier | 's' |
#define dateTemplateRegularModifier | 'r' |
#define dateTemplateLongModifier | 'l' |
#define dateTemplateLeadZeroModifier | 'z' |
Format | Short | Regular | Long | Zero |
DayNum | 5 | 5 | 5 | 05 |
DOWName | T | Tue | Tuesday | n/a |
MonthName | A | Aug | August | n/a |
MonthNum | 8 | 8 | 8 | 08 |
YearNum | 00 | 2000 | 2000 | n/a |
^0z ^2l ^4r
"
DateToAscii
, DateToDOWDMFormat
dateFormat
parameter.
void DateToAscii (UInt8 months, UInt8 days, UInt16 years, DateFormatType dateFormat, Char* pString)
  |
|
Months (1-12). |
  |
|
Days (1-31). |
  |
|
Years (for example 1995). |
  |
|
Any "DateFormatType" format. |
  |
|
Pointer to string which gets the result. Must be of length dateStringLength for standard formats or longDateStrLength for medium or long formats. (See "Time Manager Constants" for allowed lengths. |
pString.
NOTE:  If you are using a debug ROM, the string buffer is filled withdateStringLength
orlongStrLength
debugging bytes, depending on the dateFormat parameter.
TimeToAscii
,
DateToDOWDMFormat
,
DateTemplateToAscii
UInt32 DateToDays (DateType date)
  |
|
"DateType" structure. |
TimAdjust
,
DateDaysToDate
void DateToDOWDMFormat (UInt8 month, UInt8 day, UInt16 year, DateFormatType dateFormat, Char * pString)
  |
|
Month (1-12). |
  |
|
Days (1-31). |
  |
|
Years (for example 1995). |
  |
|
Any "DateFormatType" format. |
  |
|
Pointer to string which gets the result. Must be of length dateStringLength for standard formats or longDateStrLength for medium or long date formats. (See "Time Manager Constants" for string buffer lengths.) |
pString
.
DateTime.h
.
DateToAscii,
DateTemplateToAscii
Int16 DayOfMonth (Int16 month, Int16 day, Int16 year)
DateTime.h
.
Int16 DayOfWeek (Int16 month, Int16 day, Int16 year)
Int16 DaysInMonth (Int16 month, Int16 year)
void TimAdjust (DateTimePtr dateTimeP, Int32 adjustment)
  |
|
A "DateType" structure (see DateTime.h ). |
  |
|
The adjustment in seconds. |
dateTimeP
to the new date and time.
DateAdjust
UInt32 TimDateTimeToSeconds (DateTimePtr dateTimeP)
  |
|
Pointer to a "DateTimeType" structure (see DateTime.h ). |
TimSecondsToDateTime
UInt32 TimGetSeconds (void)
TimSetSeconds
UInt32 TimGetTicks (void)
void TimSecondsToDateTime (UInt32 seconds, DateTimePtr dateTimeP)
  |
|
Seconds to advance from 1/1/1904. |
  |
|
A "DateTimeType" structure that's filled by the function. |
dateTimeP.
TimDateTimeToSeconds
void TimSetSeconds (UInt32 seconds)
sysNotifyTimeChangeEvent
to all interested parties. See the "Notification Manager" chapter for more information.
TimGetSeconds
void TimeToAscii (UInt8 hours, UInt8 minutes, TimeFormatType timeFormat, Char* pString)
  |
|
Hours (0-23). |
  |
|
Minutes (0-59). |
  |
|
FALSE to use AM and PM. |
  |
|
Pointer to string which gets the result. Must be of length timeStringLength . See "Time Manager Constants" for information on string buffer lengths. |
pString
.
NOTE:  If you are using a debug ROM in PalmOS 3.5, the string buffer is filled with timeStringLength debugging bytes.
DateTime.h
. See "Time Manager Constants".
DateToAscii
  |   |