Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2004, 08:10 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting Dates

I would like to format dates from a date picker as when i put them into access they are being transposed. I need to convert them from d/m/yy format to dd/mmm/yy format. I have tried using the VB6 method, but this seems not to work, can it be done if so how?

Thanks in advance

Louisa

 
Old March 11th, 2004, 05:37 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default

  Dim mydate As Date = CType(Me.DateTimePicker1.Text, Date)
  Dim myStringDate As String = mydate.Day.ToString & "/" & _
     MonthName(mydate.Month, True).ToString & "/" & _
     mydate.Year.ToString.Substring(2, 2)

myStringDate should be what you need, you can adjust the delimiter as needed.

 
Old March 11th, 2004, 10:30 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Or you could just do this:

myStringDate = String.Format("{0:dd/MMM/yy}", CType(Me.DateTimePicker1.Text, Date))
 
Old March 16th, 2004, 05:52 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for you help

Louisa






Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Dates dhoward SQL Language 4 January 30th, 2007 04:00 PM
formatting strings / dates clandestine XML 3 June 22nd, 2005 09:52 AM
Formatting For Between Dates hcweb Classic ASP Basics 7 February 8th, 2005 02:29 AM
formatting dates treasacrowe Classic ASP Basics 3 October 20th, 2004 06:52 PM
Formatting dates in XSL francislang XSLT 4 September 3rd, 2004 08:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.