Does anyone know how to get the day of the year for a date like 21/06/2005 ?? I did found some info, but it isn't working.. thnx, Peter
Does anyone know how to get the day of the year for a date like 21/06/2005 ?? I did found some info, but it isn't working.. thnx, Peter
On 1 Jun 2005 11:33:22 -0700, "pjwolters" < XXXX@XXXXX.COM > waffled on about something: May I recommend efg's Delphi reference library. http://www.**--****.com/ I'm not sure if you're after the day of the week, sun-sat, or if you want to know how many days into the year you are. If it's day of the week, you just need to work from a known point and then do a mod7 of the result. e.g. use Monday, like Jan. 1, 1900 as the known base DaysSince1900 := TRUNC(EncodeDate(year,month,day)) - TRUNC(EncodeDate(1900,1,1)) + 1; DayOfWeek := DaysSince1900 MOD 7; // (0=Sunday, 1=Monday, ..., 6=Saturday): If you're after how far you are into the year in days, then just set the base as being the 1st of Jan of the year you are interested in. Daynum:=TRUNC(EncodeDate(year,month,day)) - TRUNC(EncodeDate(year,1,1)) + 1; Do either of those help? Dodgy. -- MUSHROOMS ARE THE OPIATE OF THE MOOSES
Yeah Thanks! I was indeed looking for the number of day in that year, it'sworking perfectly, Thnx, Peter
On 1 Jun 2005 13:00:09 -0700, "pjwolters" < XXXX@XXXXX.COM > waffled on about something: It's worth getting to grips with Delphi's Tdatetime type, it's quite a useful one. It's the number of days since 12:00 am 30th December 1899. So if you add 1 to a Tdatetime you'll have the date for the next day. The crafty thing is it also has the hours and minutes part for fractions of the day. So if you wanted to know what the time would be in 12 hours time you just take the current time in Tdatetime format (oh looks, there's one provided for you, it's called NOW), and add 12 hours to it... 12 Hours is half a day, so that's NOW+0.5. All that's left is to display the new time. datetimetostr does that for you. Dodgy. -- MUSHROOMS ARE THE OPIATE OF THE MOOSES
1.Days, Weeks, Months or Years ?
2.Today is the most depressing day of the year
According to Evning Standard. And I can confirm thay are 100% right. MH -- borland.public.off-topic exists as a runoff for unwanted posts in the technical groups. Enforcement of rules is deliberately minimal but Borland reserves the right to cancel posts at any time, for any reason, without notice.
3.Identify the first day of the current year and month
Hi I have a table that contains orders information. I need to filter the table to add all orders: a) between the start of the year (Jan 1 of the current year) and the current date (today) Year-to-date b) between the start of the current month (Day 1) and the current date today) month-to-date Is there a way to identify the first day of the current year and the first day of the current month, so I can use them in the filtering codes???? I use the following code to filter the table between two user selectable dates and would like to change it to filter the year-to-date and the month-to-date if (DateTimePicker3->Date > DateTimePicker2->Date) { Table1->Filtered = false; Table1->Filter = "Date > '" + DateTimePicker2->DateTime.FormatString(ShortDateFormat) + "'" + "AND Date < '" + DateTimePicker3->DateTime.FormatString(ShortDateFormat) + "'"; Table1->Filtered = true; } thanks in advance Rob
4.TDatetime difference in days, months and years
Hi, I have been browsing the newsgroups for a long time trying to find if this issue has been resolved by somebody. I found some solutions, but they are not very accurate. Sometimes they get one day less or they don't count the number of months correctly. I've tried everything in my code with no success. Does anybody knows a way to do it? Thanks a lot.
Doews anyone know how I can find the day of the year. If I select a date with datepicker how can I then set about finding what number day of the year it is eg: 1/1/2005 would be day 1 eg: 12/31/whatever year would be day 365 or 366 depending if it is a leap year. I have had this code somewhere, but with disk crashes etc I no longer have it Many thanks in advance Anthony
6. Getting the year of a file with FTP
Users browsing this forum: No registered users and 3 guest