C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[64356] Re:Date 함수에서 날짜만 빼오는 방법이 궁금합니다.
이길남.HoPe [miru0418] 2312 읽음    2011-05-16 09:16
두 날짜의 차이 값만 알고 싶은건지요?

TDateTime의 데이터형 타입을 보시면 정수 부분은 하루가 지날 때마다 1씩 증가합니다.

그러므로, if ( (오늘 날짜 - 이전 날짜) > 20 ) MessageBox( 날짜가 초과 됬습니다 ! )와 같이 해도 좋을것 같습니다.

참고 문헌 (델파이 헬프)

TDateTime represents a date-and-time value in the Delphi language.

Unit

System

Delphi syntax:

type TDateTime = type Double;

Description

Most CLX objects represent date and time values using a TDateTime value. In Delphi, TDateTime is a type that maps to a Double. In C++, the TDateTime class corresponds to the Delphi TDateTime type.

The integral part of a Delphi TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of the TDateTime value is fraction of a 24 hour day that has elapsed.

Following are some examples of TDateTime values and their corresponding dates and times:

0    12/30/1899 12:00 am
2.75    1/1/1900 6:00 pm
-1.25    12/29/1899 6:00 am
35065    1/1/1996 12:00 am
To find the fractional number of days between two dates, simply subtract the two values, unless one of the TDateTime values is negative. Similarly, to increment a date and time value by a certain fractional number of days, add the fractional number to the date and time value if the TDateTime value is positive.
When working with negative TDateTime values, computations must handle time portion separately. The fractional part reflects the fraction of a 24-hour day without regard to the sign of the TDateTime value. For example, 6:00 am on 12/29/1899 is ?.25, not ? + 0.25, which would be ?.75. There are no TDateTime values between ? and 0.

Note:    Delphi 1.0 calculated the date from year 1 instead of from 1899. To convert a Delphi 1.0 date to a TDateTime value in later versions of the Delphi language, subtract 693594.0 from the Delphi 1.0 date.

B-Fron 님이 쓰신 글 :
: Date 함수를 쓰면 오늘 날짜가 나오는데
:
: 예를들어 2011-05-06 이라는 값이 나왔다면 06 이라는 숫자를 빼오고 싶습니다.
:
: 즉 예를들어 사용자가 기한을 '20' 일 까지로 설정해 놓은 경우
:
: 오늘 날짜와 비교해서 날짜가 지났는지, 안지났는지를 if문으로 돌리고 싶은데
:
: 날짜만 뽑아오는 방법이 궁금하네요

+ -

관련 글 리스트
64348 Date 함수에서 날짜만 빼오는 방법이 궁금합니다. B-Fron 1124 2011/05/14
64356     Re:Date 함수에서 날짜만 빼오는 방법이 궁금합니다. 이길남.HoPe 2312 2011/05/16
64351     Re:DayOf() 함수를 쓰시면 됩니다. 박지훈.임프 1466 2011/05/15
64352         Re:Re:감사합니다! B-Fron 1129 2011/05/15
64349     Re:Date 함수에서 날짜만 빼오는 방법이 궁금합니다. Intotheblue 1657 2011/05/15
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.