Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to get the day of year?

Posted on 2000-04-27
4
Medium Priority
?
553 Views
Last Modified: 2012-05-04
has a function which can return the day of year at Delphi 4?

Thanks
0
Comment
Question by:kelvinyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:shenqw
ID: 2758125
procedure TForm1.Button1Click(Sender: TObject);
var
  Year,Month,Day:Word;
begin
  DecodeDate(now,Year,Month,Day);
  ShowMessage(IntToStr(Day));
end;
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 2758198
hi,

my guess, about what is wanted

function DayOfYear(DT : TDateTime) : Integer;
var dt1,dt2 : TDateTime;
    m,d,y    : Word;
begin
  dt1 := Trunc(DT);
  decodeDate(dt1,y,m,d);
  dt2 := encodeDate(y,1,1);
  Result := Trunc(dt1-dt2);  //maybe +1
end;

//sample to call
procedure TForm1.Button1Click(Sender: TObject);
begin
  edit1.text := inttostr(DayOfYear(DateTimePicker1.Date));
end;

meikl
0
 

Author Comment

by:kelvinyu
ID: 2768129
kretzschmar's function is just I need
0
 

Author Comment

by:kelvinyu
ID: 2768133
I just need this function, Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question