Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 27th, 2005, 09:44 PM
Registered User
 
Join Date: Mar 2005
Location: , , Singapore.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert "MM/dd/yyyy" to "dd/MM/yyyy"

Can anyone help me on how to convert "MM/dd/yyyy" to "dd/MM/yyyy"?
Thanks... :D
Below is my code:
Dim stringdate As String = "23/03/05"
Dim dd As Integer = System.Convert.ToInt32(stringdate.Substring(0, 2))
Dim mm As Integer = System.Convert.ToInt32(stringdate.Substring(3, 2))
Dim yyyy As Integer = System.Convert.ToInt32(stringdate.Substring(6, 4))

Dim dt As DateTime = New DateTime(yyyy, mm, dd)
dt = FormatDateTime(dt, "#d/m/y#")
 
Old March 27th, 2005, 10:06 PM
Authorized User
 
Join Date: Mar 2004
Location: Rawang, Selangor, Malaysia.
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You may try using this:

Dim stringDate As String = "23/03/05"
Dim ArrDate() As String
Dim DTddMMyyyy As DateTime

ArrDate = split(stringDate, "/")
DTddMMyyyy = ctype(string.concat(ArrDate(1), "/", ArrDate(0), "/", ArrDate(2)), DateTime)
 
Old March 27th, 2005, 11:46 PM
Registered User
 
Join Date: Mar 2005
Location: kl, kl, Malaysia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if u r using vb.net just try this code

msgbox today.date & "/" & today.month & "/" today.year

it worked out for me

try it!!!

 
Old March 28th, 2005, 12:10 AM
Registered User
 
Join Date: Mar 2005
Location: kl, kl, Malaysia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
  try this, function that converts date format !!!!

Public Sub changedateformat()
    Dim Msg As String 'Declare variables.
    Dim SecondDate As Date
    SecondDate = CDate(editCDTDATE.Text)
    'editcdtdate is date entered by user in text box
    Msg = DatePart(DateInterval.Day, SecondDate) & "/" & DatePart (DateInterval.Month, SecondDate) & "/" & DatePart(DateInterval.Year, SecondDate)
    editCDTDATE.Text = msg
End Sub

 
Old March 28th, 2005, 05:33 AM
Registered User
 
Join Date: Mar 2005
Location: , , Singapore.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help but I have already solve the problem. :D
I need to insert the date according to the computer's regional settings.

Dim dd As Integer = System.Convert.ToInt32(stringdate.Substring(0, 2))
Dim mm As Integer = System.Convert.ToInt32(stringdate.Substring(3, 2))
Dim yyyy As Integer = System.Convert.ToInt32(stringdate.Substring(6, 4))

Dim dt As DateTime = New DateTime(yyyy, mm, dd)
dt = FormatDateTime(dt, DateFormat.LongDate)

This website provide me the information.
http://msdn.microsoft.com/library/de...atdatetime.asp





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert dd/MM/yyyy to MM/dd/yyyy Rg2005 VB.NET 2002/2003 Basics 2 November 7th, 2008 06:42 PM
Date dd-mm-yyyy John2112 SQL Server 2000 2 March 16th, 2007 05:15 AM
mm/dd/yyyy to dd/mm/yyyy Ashleek007 Beginning PHP 2 September 27th, 2006 06:35 AM
Convert getdate() -> dd/mm/yyyy? minhpx SQL Language 1 January 3rd, 2005 09:30 AM
Date formats... dd/mm/yyyy SeanW Classic ASP Databases 3 June 14th, 2004 12:34 PM





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