Другие языки программирования и технологии

Программирование в С++. Вопрос по времменным типам.

Фишка такая. В программе надо получая значения из компонента dateTimePicker надо в нести его в таблицу. Проблема в том что значение даты которое берет программа записываеться в формате System::DateTime. Ввод в таблицу данные в типе time_t. вот кусочек кода time_t dat1; time_t dat2; dat1=dateTimePicker1->Value; // дата выдачи dat2=dateTimePicker2->Value; // дата сдачи Подскажите плиз как перевести полученные данные из компонента dateTimePicker в данные типа time_t
#include <stdio.h>
#include <time.h>

char *wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Unknown"};

int main(void)
{
struct tm time_check;
int year, month, day;

/* Input a year, month and day to find the weekday for */
printf("Year: ");
scanf("%d", &year);
printf("Month: ");
scanf("%d", &month);
printf("Day: ");
scanf("%d", &day);

/* load the time_check structure with the data */

time_check.tm_year = year - 1900;
time_check.tm_mon = month - 1;
time_check.tm_mday = day;
time_check.tm_hour = 0;
time_check.tm_min = 0;
time_check.tm_sec = 1;
time_check.tm_isdst = -1;

/* call mktime to fill in the weekday field of the structure */
if (mktime(&time_check) == -1)
time_check.tm_wday = 7;

/* print out the day of the week */
printf("That day is a %s\n", wday[time_check.tm_wday]);
return 0;

}

Separates the TDateTime value into year, month, and day values and stores these values in the year, month, and day parameters, respectively.

void __fastcall DecodeDate(unsigned short* year, unsigned short* month, unsigned short* day) const;

Description

Use DecodeDate() when you need to access the year, month, or day of a TDateTime object’s date portion.

Separates the TDateTime value into hour, minute, second, and millisecond values and stores these values in the hour, min, sec, and msec parameters, respectively.

void __fastcall DecodeTime(unsigned short* hour, unsigned short* min, unsigned short* sec, unsigned short* msec) const;

Description

Use DecodeTime() to access the hour, minute, second, or millisecond values of the TDateTime object’s time portion.

Думаю все получится.
Azat Ilmuradov
Azat Ilmuradov
2 619
Лучший ответ

Похожие вопросы