ionsurge
10-22-2002, 12:27 PM
Anyone know how to display the day of the week in a label component?
Cheers.
Ionsurge.
Cheers.
Ionsurge.
|
||||
Displaying dates using TLabel in C+Builder.ionsurge 10-22-2002, 12:27 PM Anyone know how to display the day of the week in a label component? Cheers. Ionsurge. dhtroy 11-04-2002, 03:59 AM Syntax should be similar to Delphi, since they both share the VCL, so I'm guessing it's something along the lines of TLabel lblDate; lblDate.caption = DateTimeToStr( Now() ); I realize that C++ is case sensative, so I leave it up to you to figure that much of it out. Hope that helped ... :thumbsup: ionsurge 11-04-2002, 12:06 PM I will try that out later today, thanx for that. Ionsurge. ionsurge 11-04-2002, 05:15 PM Thanx, but that is not exactly what I was looking for, it works in that it displays the date, e.g. 04/11/02. I was looking for something that would show the date as 'Monday 4 November 2002' All I had to do with the code was: before: lblDate.caption = DateTimeToStr( Now() ); after: lblDate->Caption = DateTimeToStr( Now() ); Ionsurge. dhtroy 11-07-2002, 05:39 PM Since I do not have access to the Delphi help files at the moment, I can only suggest the following ... In the C++ Builder help file system, look up Date Formats pertaining to Long/Short date formats. Also look for DayOfWeek functions; or search on the Now() function and check out what they have listed under "Also see". If you are in need of the help files, they can be downloaded from Borland's website. They are about 11mb. Good-luck, D. ionsurge 11-11-2002, 10:06 AM I got the help files with the C++Builder CD, and the DayOfTheWeek thing is pretty good. I cant believe that I have been stressing over it for so long and it was just there. If I have any probs, I will let you know. Cheers. Ionsurge. ionsurge 11-12-2002, 10:20 AM Wohoo, thanx mate, I got it to work. I had to re-write some of the code, and add a bit of my own. The code would look something like this: StatusBar1->Panels->Items[3]->Text = DateToStr(Date()); char days[7][10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; TDateTime dtDate = StatusBar1->Panels->Items[3]->Text; StatusBar1->Panels->Items[3]->Text = days[dtDate.DayOfWeek() -1]; I used a similar thing to make it show the day, and year on the status bar. It is in C++, so it may look a bit strange to some of you all. Ionsurge. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum