Другие языки программирования и технологии
Программирование в С++. Вопрос по времменным типам.
Фишка такая. В программе надо получая значения из компонента 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.
Думаю все получится.
#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.
Думаю все получится.
Похожие вопросы
- Кто занимается программированием ответьте на вопрос такой ниже все у всех ли языков так?
- Где практиковаться в программировании? Начинаю изучать программирование и задаюсь вопросом, как практика проходит?
- Знатоки программирования... у меня вопрос
- Несколько вопросов про преобразование типов в С++ и возможно не только.
- Сколько времени уйдёт чтобы полностью овладеть языком программирования Java Script? ВОПРОСОМ НА ВОПРОС НЕ ОТВЕЧАТЬ!!!!
- Кто знает языки программирования более менее вопрос вам
- Помогите пожалуйста разобраться с вопросами по информатике и программированию
- Вопрос для тех, кто уже опытный и профессиональный специалист в сфере программирования, web-программирования, дизайн!..
- Вопрос про изучение языков программирования
- Добрый день! Ответьте на извечный вопрос для новичка по программированию? How to start programming?