Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo

  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:

Anonymous Anonymous said...

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.

3:02 AM  
Anonymous Anonymous said...

try this..

dim Date1 as datetime

date1= DateTimePicker1.value
msgbox date1

3:18 AM  
Anonymous Anonymous said...

dim Date1 as datetime

date1= DateTimePicker1.value
msgbox date1

3:23 AM  

Post a Comment

<< Home

 
Previous Posts
    - Dynamic Expression Evaluation
    - Finding the Printable area
    - How to add a dimension to an array in VB.NET
    - How to access a Specific Mailbox on Exchange
    - DataGrids and obtaining information from them
    - Turn of time Automatic update in DateTimePicker Co...
    - datetime.addminutes
    - How to draw a rectangle on a form
    - Protect from Reverse engineering
    - Reading MS Access OLE fields

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland