Hi, Ramel
Thank you for your help.
I tried to use the following code for getting date and time. However, it
wasn't work. Would you mind take a look, and help me out.
FormPtr form;
UInt handled = 0;
UInt index;
VoidHand RecHandle;
Ptr RecPointer;
CharPtr pString;
Word error = 0;
Err err = 0;
SystemPreferencesType sysPrefs;
DateTimeType dateTime;
form = FrmGetActiveForm();
switch (event->eType)
{
case frmOpenEvent:
FrmDrawForm(form);
handled = 1;
//Get the time formats from the system preferences.
TimeFormat = sysPrefs.timeFormat;
//Get the date formats from the system preferences
LongDateFormat = sysPrefs.longDateFormat;
ShortDateFormat = sysPrefs.dateFormat;
//Get today's date
TimSecondsToDateTime (TimGetSeconds (), &dateTime);
Date.year = dateTime.year - firstYear;
Date.month = dateTime.month;
Date.day = dateTime.day;
DateToAscii((Word)Date.year,(Byte)Date.month,(Byte)Date.day,pString);
// print the time to the PC time/date field
fieldptr_datetime_date = FrmGetObjectPtr(form,
FrmGetObjectIndex(form, fieldID_datetime_date));
FldSetTextPtr(fieldptr_datetime_date, pString);
FldRecalculateField(fieldptr_datetime_date, true);
Thank you, again
Allen
-----Original Message-----
From: Ramel Levin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 29, 1999 11:31 AM
To: [EMAIL PROTECTED]
Subject: Re: How to show system date and time in the form?
If you mean how to present a date in the right format use something like
this:
DateToAscii((Byte)date.month, (Byte)date.day, (Word)date.year,
(DateFormatType)PrefGetPreference(prefDateFormat), dateStr);
There is a TimeToAscii which works about the same....
Ramel Levin
CTO
The PalmMate Team
Gotta Palm? Gotta visit www.PalmMate.com
----- Original Message -----
From: Allen Yang <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 29, 1999 4:03 PM
Subject: How to show system date and time in the form?
> Hi,
> Anyone can show me how to show the system date and time in the form?
> I created a form. In the form, I need show the PC date and time in two
> different field. One is for time, and another one for date. I don't know
> how to make this work?
>
> I will appreciated any help.
>
> allen
>
>