how can i get full months date

Thread Solved

Join Date: Jan 2009
Posts: 14
Reputation: devilz is an unknown quantity at this point 
Solved Threads: 0
devilz devilz is offline Offline
Newbie Poster

how can i get full months date

 
0
  #1
Jan 27th, 2009
I’m very very new in VB6.0 in my project I need a function where I want to pass month name as variable value which will be selected from a combo box by user and the function will generate the full date from starting to end along with the weekday name.

Suppose user select the month “JANUARY” and year from different combo box. Under combo box click event that function will work and will generate the valid date from 1st January to 31th January along with the weekday name. like:

01-Jan-09 Thursday, 02-Jan-09 Friday, 03-Jan-09 Saturday, 04-Jan-09 Sunday, 05-Jan-09 Monday, 06-Jan-09 Tuesday, 07-Jan-09 Wednesday, 08-Jan-09 Thursday, 09-Jan-09 Friday, 10-Jan-09 Saturday, 11-Jan-09 Sunday, 12-Jan-09 Monday, 13-Jan-09 Tuesday, 14-Jan-09 Wednesday, 15-Jan-09 Thursday, 16-Jan-09 Friday, 17-Jan-09 Saturday, 18-Jan-09 Sunday, 19-Jan-09 Monday, 20-Jan-09 Tuesday, 21-Jan-09 Wednesday, 22-Jan-09 Thursday, 23-Jan-09 Friday, 24-Jan-09 Saturday, 25-Jan-09 Sunday, 26-Jan-09 Monday, 27-Jan-09 Tuesday, 28-Jan-09 Wednesday, 29-Jan-09 Thursday, 30-Jan-09 Friday, 31-Jan-09 Saturday.

LevelText of 31 unique level (control) will display those dates. All the date must be valid. I’m requesting all of my seniors, plz plz help me.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,093
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 126
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: how can i get full months date

 
0
  #2
Jan 27th, 2009
1. select the month.
2. findout all the dates.
3. findout the days by passing the dates ---use WEEKDAYNAME function for the purpose.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: how can i get full months date

 
0
  #3
Jan 27th, 2009
Yes, Debasisdas is correct.
Refer

WeekDayName ()
WeekDay ()
&
Other Date Functions
to achieve this.

WeekDayName ( WeekDay ( Date ) ) returns today date in String
KSG
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: devilz is an unknown quantity at this point 
Solved Threads: 0
devilz devilz is offline Offline
Newbie Poster

Re: how can i get full months date

 
0
  #4
Jan 31st, 2009
Originally Posted by debasisdas View Post
1. select the month.
2. findout all the dates.
3. findout the days by passing the dates ---use WEEKDAYNAME function for the purpose.
Dear debasis,

As i have mentioned i'm very new in VB and your profile says that you are much experienced. Can you give me some example or some sample coding which will meet the needful? Please bro, I need it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: devilz is an unknown quantity at this point 
Solved Threads: 0
devilz devilz is offline Offline
Newbie Poster

Re: how can i get full months date

 
0
  #5
Jan 31st, 2009
Dear Salvaganapathy,

Please help me in details. Can you help me with some sample coding. Please....
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: how can i get full months date

 
0
  #6
Feb 4th, 2009
go here. http://www.vb6.us/tutorials/formatin...-and-times-vb6
it gives different date formats and examples
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: how can i get full months date

 
0
  #7
Feb 7th, 2009
Hi,

Try This Code:

  1. Dim FromDate As Date
  2. Dim ToDate As Date
  3. Dim TempDate As Date
  4. Combo1.clear
  5. FromDate = DateSerial(Val(cmbYear.Text), (CmbMonth.ListIndex+1), 1)
  6. ToDate = DateAdd("m", 1, FromDate)
  7. ToDate = ToDate - 1
  8. TempDate = FromDate
  9. For TempDate = FromDate To ToDate
  10. Combo1.AddItem (Format(TempDate, "dd-mm-yyyy") & " " _
  11. & WeekdayName(Weekday(TempDate)))
  12. Next

Populate Months in Combobox in the Ascending Order(Jan, Feb, Mar...), and keep Sorted of ComboMonth = False

Regards
Veena
Last edited by QVeen72; Feb 7th, 2009 at 10:42 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1
Reputation: puran_ansh08 is an unknown quantity at this point 
Solved Threads: 1
puran_ansh08 puran_ansh08 is offline Offline
Newbie Poster

Re: how can i get full months date

 
0
  #8
Feb 14th, 2009
Originally Posted by QVeen72 View Post
Hi,

Try This Code:

  1. Dim FromDate As Date
  2. Dim ToDate As Date
  3. Dim TempDate As Date
  4. Combo1.clear
  5. FromDate = DateSerial(Val(cmbYear.Text), (CmbMonth.ListIndex+1), 1)
  6. ToDate = DateAdd("m", 1, FromDate)
  7. ToDate = ToDate - 1
  8. TempDate = FromDate
  9. For TempDate = FromDate To ToDate
  10. Combo1.AddItem (Format(TempDate, "dd-mm-yyyy") & " " _
  11. & WeekdayName(Weekday(TempDate)))
  12. Next

Populate Months in Combobox in the Ascending Order(Jan, Feb, Mar...), and keep Sorted of ComboMonth = False

Regards
Veena
Hi Sweetheart How r u ?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 14
Reputation: devilz is an unknown quantity at this point 
Solved Threads: 0
devilz devilz is offline Offline
Newbie Poster

Re: how can i get full months date

 
0
  #9
Feb 15th, 2009
Hello veena,

Thank you very much for the support. I also found a way:


' given month number (1 through 12) and year, generate list of all days in month:
monthNum = 1 ' or wherever you get this from, e.g., from the combo box
yearNum = 2009
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim firstOfMonth As Date, lastOfMonth As Date
  2. firstOfMonth = DateSerial( yearNum, monthNum, 1 )
  3. lastOfMonth = DateSerial( yearNum, monthNum+1, 0 )
  4. For myDate = firstOfMonth To lastOfMonth
  5. Dim oneDate As String
  6. oneDate = Right("0" & Day(myDate),2) & "-" & MonthName(Month(myDate),True) _
  7. & Right(CStr(Year(myDate)),2) & " " & WeekdayName(Weekday(myDate))
  8. ... do something with "oneDate" ...
  9. Next

Thanks veena.
Last edited by Ancient Dragon; Feb 15th, 2009 at 7:04 pm. Reason: removed list tags and added code tags
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC