DateTimePicker AM/PM


2004-05-24 07:18:34 AM
cppbuilder76
I have a checkbox in my program to specify if a TimePicker time should be in
AM or PM
now I live in Sweden where we use 24 hour time so I wonder if I got this
right. One thing
that confuse me is that our 00:00 (24:00) and 12:00 both convert to 12:00 AM
double time1 = TimePicker->Time;
double test1 = fmod(time1, 1.0);
if(CB_AM->Checked) // we want AM
{
if( test1>0.5) //time is PM
{
time1 -= 0.5;
TimePicker->Time = time1;
}
}
else // we want PM
{
else if( test1 <= 0.5) //time is AM
{
time1 += 0.5;
TimePicker->Time = time1;
}
}
/Jonas