Solved

How to get the day of year?

Posted on 2000-04-27
4
547 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
  • 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 50 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now