[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Several Easy Questions

how to get the year in delphi? Only Year
Time--Seconds,Min,hour?

what is the Difference between showmessage and MessageBox???
when you do Form1.ShowModal, does the form re-do the job in the FormLoad thing?
0
peritoX
Asked:
peritoX
1 Solution
 
DavidBirch2dotComCommented:
0
 
DavidBirch2dotComCommented:
All the functions for Date and Time handling explained in Depth so you should find exactly what you need
http://www.delphibasics.co.uk/ByFunction.asp?Main=DatesAndTimes

A modal form will return a result, for example a message box is really a form, its a modal form as it can send back a responce - yes or no - the same with an input box

The messagebox function has more options, than the showmessage function

David
0
 
peritoXAuthor Commented:
dont see anything that gives the year only
does such function exist?
0
Independent Software Vendors: 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!

 
DavidBirch2dotComCommented:
I dont think so that list is very comprehensive,

you could put it into a string and then copy the last 4 characters ?

copy(string, length(string)-1,4)

(you may or may not need the -1 bit)

David
0
 
esoftbgCommented:
uses
  ...., DateUtils;

//........

var
  Y:   Word; // Integer;
begin
  Y := YearOf(Today);
end;

//........

var
  S:    string;
begin
  S := FormatDateTime(ss:mm:HH, Now);
end;

//........

  if (MessageDlg('Welcome to my Delphi application.  Exit now?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes) then
  begin
    MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk);
    Close;
  end;

//........

    ShowMessage('Manchester, England, England ....')
0
 
ChessoCommented:
ShowMessage() simply shows a string in a msgbox but MessageDlg can msgbox a string have an icon like mtWarning or mtInformation and have Ok/Cancel/Retry buttons etc on it and return values for each one so you know which was clicked.
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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now