Date format problem with vb.net
(Thursday, September 02, 2004)
Found the following interesting discussion in the Newsgroups:
My post disappeared - date format problem by:Coleen
| Hi all :-)
My post on weird date formatting disappeared from my list, so if this a duplicate post, I apologize.
I'm having trouble getting a date to format as just "MM/dd"
I don't care what the year is, I get that information first, then need to format the data as MM/dd to look for the Month and day to check if it is a Holiday. If it is a Holiday, and falls on a Monday (I can get the dddd to format just fine!), then I need to make the due date fall on the Tuesday after the Holiday. I've tried:
ls_due_dt = ld_due_dt.ToString() then, using String.Format("MM/dd", ls_due_dt)
I've also tried Format(ls_due_dt, "MM/dd") which just gives me a literal string of "MM/dd". Any suggestions? TIA
Coleen
--- Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
| | | Reply: by:Ken Tucker [MVP]
| | | Hi,
Me.Text = Now.ToString("MM/dd")
Ken
| | | Reply: by:DotNetJunkies User
| | | Thanks for the help. I will try that, to see if it will work for me :-)
I finally got the date to format using:
ls_due_dt = Format(ld_due_dt, "dd-MMMM")
This works, it's just more wordy when writing the code I have to use "01-January" instead of "01/01"
|

|
3 Comments:
dim Date1 as date
date1= DateTimePicker1.value
I expect full date and time (yyyy/mm/dd hh:mm:ss AM)to be assigned to date1.
But date1 contains only date portion (yyyy/mm/dd).
Is there any body who can help me fix the problem.
try this..
dim Date1 as datetime
date1= DateTimePicker1.value
msgbox date1
dim Date1 as datetime
date1= DateTimePicker1.value
msgbox date1
Post a Comment
<< Home