|
-
Aug 4th, 2009, 04:57 AM
#1
Thread Starter
Junior Member
[RESOLVED] Problem with date difference
Hi All,
I've a vb3 application. I need to modify the application to do the below.
For example,
date1, date2, date3 are the calculation dates. If my transaction has a date say trdate, then if the trdate is equal to date1, then add the amount, if it's equal to date2, then add the amount with that on date2 and so on.
My problem is this date1, date2, date3 can only be valid business dates, i.e. no sat,sun or holidays and if the trdate is equal to date1 - add the amount with that on date1, if it's greater than date1 and lesser than date2 and if the difference between trdate and date2 is just one day. i.e. one holiday after date1, then add the amount with date2, if it's greater than 1 i.e. 2 or more holidays then add with that in date3.
Hope I've not confused.. Any suggestions to find the date difference is much appreciated...
Thanks a lot.
-
Aug 4th, 2009, 04:02 PM
#2
Re: Problem with date difference
Here is a start
1) Use the Weekday(). This function returns a number from 1 to 7 indicating the day of the week for a given date, where 1 is Sunday and 7 is Saturday.
2) Now as for holidays are concerned... What holidays are you considering? US holidays, UK holidays or some other? See this link on how to determine any holiday?
http://www.tek-tips.com/faqs.cfm?fid=5185
3) To compare dates use the DateDiff(). The DateDiff function returns a long integer specifying the number of time intervals between two specified dates.
4) Once you have these in place then I don't think you will have a problem with the rest of the code but if you still get stuck then do post the code that you have tried and we will definitely help you...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 4th, 2009, 04:19 PM
#3
Re: Problem with date difference
@koolsid:
not totally sure about the Weekday but DateDiff was definitely not available in VB3 - it first appeared in VB6.
-
Aug 4th, 2009, 04:31 PM
#4
Re: Problem with date difference
Ah My bad!!! missed that part...
that means more coding
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 4th, 2009, 07:23 PM
#5
Re: Problem with date difference
I take it back - just ran VB3 and guess what: both functions were available.
Arghhhhh... I guess last 3 replies (including this one) can be deleted.
-
Aug 5th, 2009, 12:55 AM
#6
Re: Problem with date difference
 Originally Posted by RhinoBull
I take it back - just ran VB3 and guess what: both functions were available.
Arghhhhh... I guess last 3 replies (including this one) can be deleted. 
Where did you get VB3 from?????
No I guess it is no point deleting these posts as it vouches that these functions do work in vb3
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Aug 5th, 2009, 07:12 AM
#7
Re: Problem with date difference
I downloaded it from MSDN but still have on dozen of floppies (preserving the history ).
-
Aug 5th, 2009, 09:44 AM
#8
Thread Starter
Junior Member
Re: Problem with date difference
Hi,
I'm able to solve this using datediff.
Thanks a lot for the suggestions.
-
Aug 5th, 2009, 01:40 PM
#9
Re: Problem with date difference
Great. If your query is solved then do remember to mark this thread resolved. There is a link in my signature on how to do it
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|