By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

displaying date by counting on days

P: 44
hey there all..
i have a several questions about how to displaying date by counting on days..
i get the current date, and how to display date for:
1. end of this month
2. the 15th of next month
3. 30days from the current date

thank u guyz...
Nov 25 '07 #1
Share this Question
Share on Google+
11 Replies


P: 44
im using combo box for the list and a textbox to display the date by the way,
does anyone know how the coding is?
Nov 26 '07 #2

lotus18
100+
P: 866
im using combo box for the list and a textbox to display the date by the way,
does anyone know how the coding is?
Use the AddDate function and Now.
Nov 26 '07 #3

P: 44
Use the AddDate function and Now.
but for what i need is this:
to display the date of:
1. the end of this month
2. the 15th of next month
3. 30days from the current date
im using combobox for the list of that 3 kinds days,
and as for the display of the date, im using textbox..

do u know how?

thankz alot.......
Nov 26 '07 #4

Expert 5K+
P: 8,434
You haven't said what version of VB you're using. But in VB6, the DateSerial() function is very useful for this sort of thing. I'd recommend you check it out. It allows you to easily generate a date using constant values, variables, or calculations/offsets (such as today + 30, for example).
Nov 26 '07 #5

P: 44
You haven't said what version of VB you're using. But in VB6, the DateSerial() function is very useful for this sort of thing. I'd recommend you check it out. It allows you to easily generate a date using constant values, variables, or calculations/offsets (such as today + 30, for example).
yeah im using VB6..
do you have the example how to use this function?
such as to display the date of the end of the month?
thanks in advance.......
Nov 26 '07 #6

Mohan Krishna
100+
P: 115
yeah im using VB6..
do you have the example how to use this function?
such as to display the date of the end of the month?
thanks in advance.......
Hi

This may help you... if I got you right
Expand|Select|Wrap|Line Numbers
  1. Combo1.AddItem (Format(DateAdd("d", -1, DateSerial(Year(Now), Month(Now) + 1, 1)), "dd-mm-yyyy"))
  2. Combo1.AddItem (Format(DateAdd("d", 14, DateSerial(Year(Now), Month(Now) + 1, 1)), "dd-mm-yyyy"))
  3. Combo1.AddItem (Format(DateAdd("d", 30, DateSerial(Year(Now), Month(Now), Day(Now))), "dd-mm-yyyy"))
  4.  
I used Format(), and if you don't need uou can remove.

ALL THE BEST!
Nov 26 '07 #7

Expert 5K+
P: 8,434
Thanks for the examples, Mohan. Just one thing - I think the final one is much longer than necessary.

Expand|Select|Wrap|Line Numbers
  1. Combo1.AddItem (Format(DateAdd("d", 30, DateSerial(Year(Now), Month(Now), Day(Now))), "dd-mm-yyyy"))
  2. ' This could easily be coded as...
  3. Combo1.AddItem (Format(DateAdd("d", 30, Now), "dd-mm-yyyy"))
  4.  
Also, it might be better to use a named format such as "Short date" or "Medium date" rather than "dd-mm-yyyy" because diferent people (and countries) prefer different formats.
Nov 26 '07 #8

Mohan Krishna
100+
P: 115
Thanks for the examples, Mohan. Just one thing - I think the final one is much longer than necessary.
:
:
Also, it might be better to use a named format such as "Short date" or "Medium date" rather than "dd-mm-yyyy" because diferent people (and countries) prefer different formats.
Than Q Killer!
I wrote in the flow. Sorry and Thanks!
Nov 26 '07 #9

P: 44
To Mr. Mohan and Mr. Killer,
thank you so much for the examples...
it really helps...
=)
Nov 26 '07 #10

Expert 5K+
P: 8,434
To Mr. Mohan and Mr. Killer,
thank you so much for the examples...
it really helps...
=)
Glad we could help. :)
Nov 27 '07 #11

Mohan Krishna
100+
P: 115
To Mr. Mohan and Mr. Killer,
thank you so much for the examples...
it really helps...
=)
Hi
To my knowledge, I could help and ALL THE VERY BEST!
Nov 27 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.