|
-
May 18th, 2005, 10:49 PM
#1
Thread Starter
Lively Member
Date in words [Resolved]
Hi guys, I need to display the date in words but I have no idea on where to start. What i mean by "in words" is for example the date that I got is 5/24/2005, I should display this as May 25, 2005. Could you guys please help me on this one? Also, Im trying to retrieve the first day of the week. For instance, if today is wednesday, May 18 then when i click a button it should appear May 16 (since monday is the start of the week). Please help. Thanks in advance guys.
Last edited by trex; May 19th, 2005 at 02:20 AM.
-
May 18th, 2005, 10:54 PM
#2
Re: Date in words
FormatDateTime([date], vbLongDate)
-
May 19th, 2005, 12:37 AM
#3
Re: Date in words
 Originally Posted by trex
Hi guys, I need to display the date in words but I have no idea on where to start.  What i mean by "in words" is for example the date that I got is 5/24/2005, I should display this as May 25, 2005. Could you guys please help me on this one? Also, Im trying to retrieve the first day of the week. For instance, if today is wednesday, May 18 then when i click a button it should appear May 16 (since monday is the start of the week). Please help. Thanks in advance guys.
For the first case :
VB Code:
MsgBox Format(#5/30/2005#, "dddd mmmm dd, yyyy")
For the second case:
VB Code:
MsgBox Format(#5/30/2005# - Weekday(#5/30/2005#, vbMonday) + 1, "dddd mmmm dd, yyyy")
-
May 19th, 2005, 12:49 AM
#4
Re: Date in words
To get the date of the first day of the current week:
VB Code:
MsgBox FormatDateTime(DateAdd("d", -Weekday(Now, vbMonday) + 1, Now), vbLongDate)
This use the Weekday function that returns a value between 1 and 7 depending on which weekday it is. 1 = the first day of the week. The second argument to the Weekday function specifies which day that should be considered to be the first day of the week, many countries consider Sunday as the first day (and is also the default value for this argument). You can also use vbUseSystem for this argument that will use the weekday specified by your regional settings.
Edit: Sorry Pradeep1210, I didn't see your post. However it might be easier to use the datediff function then substracting two dates, since you don't know what date the current date is.
-
May 19th, 2005, 12:57 AM
#5
Thread Starter
Lively Member
Re: Date in words
Thank you so much for all your help,guys. i really appreciate it.
-
May 19th, 2005, 01:16 AM
#6
Thread Starter
Lively Member
Re: Date in words
hmmm i'm getting the correct date now but it also displays the day ie Tuesday, Wednesday etc. is there a way for me to remove this?
-
May 19th, 2005, 02:04 AM
#7
Fanatic Member
Re: Date in words
just change
VB Code:
MsgBox Format(#5/30/2005#, "dddd mmmm dd, yyyy")
to
VB Code:
MsgBox Format(#5/30/2005#, "mmmm dd, yyyy")
"dddd" means that he has to display the name of the day
-
May 19th, 2005, 02:20 AM
#8
Thread Starter
Lively Member
Re: Date in words
hahahaha how silly of me... thank you so much robbedaya
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
|