Jun 30, 2004 #1 TaTips Programmer Oct 29, 2003 25 GB Hi: can anyone suggest how to calculate the difference between two dates in Weeks and Days please ? Eg. 3 Weeks 2 Days Thanks. Ta.
Hi: can anyone suggest how to calculate the difference between two dates in Weeks and Days please ? Eg. 3 Weeks 2 Days Thanks. Ta.
Jun 30, 2004 #2 Reebo99 MIS Jan 24, 2003 1,074 GB Try this, replace the items in bold with your real dates.... Local NumberVar NumofDays := DateDiff("d",Date(2004,01,01),Date(2004,01,22))+1; ToText(NumofDays/7,0)&" week(s) "&ToText(NumofDays-(Int(NumofDays/7)*7),0)&" day(s)" Reebo Upvote 0 Downvote
Try this, replace the items in bold with your real dates.... Local NumberVar NumofDays := DateDiff("d",Date(2004,01,01),Date(2004,01,22))+1; ToText(NumofDays/7,0)&" week(s) "&ToText(NumofDays-(Int(NumofDays/7)*7),0)&" day(s)" Reebo
Jun 30, 2004 Thread starter #3 TaTips Programmer Oct 29, 2003 25 GB Thanks for reply reboo but I dont think its quite there. i may be wrong though. My dates are 04-JUN-2004 and 01-JUL-2004: This makes it 26 days in total the formula returns 4 Weeks and 3 days. I make it 26/7 = 3 Weeks and 5 Days. Not sure here. Thanks. ta. Upvote 0 Downvote
Thanks for reply reboo but I dont think its quite there. i may be wrong though. My dates are 04-JUN-2004 and 01-JUL-2004: This makes it 26 days in total the formula returns 4 Weeks and 3 days. I make it 26/7 = 3 Weeks and 5 Days. Not sure here. Thanks. ta.
Jun 30, 2004 #4 lbass Technical User Feb 9, 2002 32,816 US Try: totext(truncate(datediff("d",date(2004,06,04),date(2004,07,01))/7,0),0,"")+" Weeks " + totext(remainder(datediff("d",date(2004,06,04),date(2004,07,01)),7)-1,0,"")+" Days" -LB Upvote 0 Downvote
Try: totext(truncate(datediff("d",date(2004,06,04),date(2004,07,01))/7,0),0,"")+" Weeks " + totext(remainder(datediff("d",date(2004,06,04),date(2004,07,01)),7)-1,0,"")+" Days" -LB
Jul 1, 2004 #5 Reebo99 MIS Jan 24, 2003 1,074 GB TaTips, In future, you need to specify your requirements a bit more clearly. You want the difference between 2 dates, Not including the 2 dates specified, is this correct? If so, use: Local NumberVar NumofDays := DateDiff("d",Date(2004,06,04),Date(2004,07,01))-1; ToText(Truncate(NumofDays/7),0)&" week(s) "&ToText(NumofDays-(Int(NumofDays/7)*7),0)&" day(s)" The solution I provided originally, gave you the difference including the 2 dates. Reebo Upvote 0 Downvote
TaTips, In future, you need to specify your requirements a bit more clearly. You want the difference between 2 dates, Not including the 2 dates specified, is this correct? If so, use: Local NumberVar NumofDays := DateDiff("d",Date(2004,06,04),Date(2004,07,01))-1; ToText(Truncate(NumofDays/7),0)&" week(s) "&ToText(NumofDays-(Int(NumofDays/7)*7),0)&" day(s)" The solution I provided originally, gave you the difference including the 2 dates. Reebo
Jul 1, 2004 Thread starter #6 TaTips Programmer Oct 29, 2003 25 GB Thanks Reboo and Everyone else. Tatips Upvote 0 Downvote