ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 1st, 2003, 09:31 AM
karthikk_p karthikk_p is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 20 karthikk_p User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How i can get the name of the day a particular date using vb?

How i can get the name of the day a particular date using vb?

Reply With Quote
  #2  
Old September 1st, 2003, 12:40 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Here is a quick way to do it in VB
Code:
Private Sub Form_Load()

    'Insert today's Date in the textbox
    Text1.Text = Date
    
End Sub

Private Sub cmdDay_Click()

    Dim daynum As Integer, sweekday As String
    
    'Figure out the day
    daynum = DatePart("w", Text1.Text)
    
    Select Case (daynum)
        Case 1
            sweekday = "Sunday"
        Case 2
            sweekday = "Monday"
        Case 3
            sweekday = "Tuesday"
        Case 4
            sweekday = "Wednesday"
        Case 5
            sweekday = "Thursday"
        Case 6
            sweekday = "Friday"
        Case 7
            sweekday = "Saturday"
        Case Else
            sweekday = "unknown"
    End Select
    
    Text2.Text = sweekday
    
End Sub
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old September 1st, 2003, 12:42 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Attached is the full sample
Attached Files
File Type: zip weekdayshow.zip (1.6 KB, 367 views)

Reply With Quote
  #4  
Old September 1st, 2003, 07:26 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
In ASP there's a function called WeekdayName() - so chances are you'll have it in VB too.

WeekdayName(weekday, abbreviate, firstdayofweek) - where "weekday" is an int, abbreviate is a boolean (yes/no), and firstdayofweek defines the starting day of the week (Sunday is the default)

Reply With Quote
  #5  
Old September 2nd, 2003, 04:53 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Thanks Stumpy:
That simplifies the code a lot:

Code:
Private Sub Form_Load()

    'Insert today's Date in the textbox
    Text1.Text = Date
    
End Sub

Private Sub cmdDay_Click()
    
    Text2.Text = WeekdayName(DatePart("w", Text1.Text), False)
    
End Sub

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > How i can get the name of the day a particular date using vb?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT