How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.net +asp.net
6 Replies - 82630 Views - Last Post: 19 November 2009 - 03:19 AM
#1
How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 01 December 2007 - 03:04 AM
#5
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 01 December 2007 - 05:47 AM
It's all done with your format, for the format you're looking for try something like this, I create a function for my application, in the event I need different display within an application, so my function looks like so:
Then When I use it I call it like so:
Try that out and see if that is what you're looking for. Hope it helps
Public Function ChangeFormat(ByVal dtm As DateTime, ByVal format As String) As String Return dtm.ToString(format) End Function
Then When I use it I call it like so:
TextBox1.Text = ChangeFormat(DateTime.Now,"MM/dd/yyyy")
Try that out and see if that is what you're looking for. Hope it helps
#9
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 16 September 2009 - 12:30 AM
Rg2005, on 1 Dec, 2007 - 02:04 AM, said:
How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.net +asp.net
hello viewers
if u r giving custom format of datetimepicker property with "dd/MM/yyyy" if u want to convert this format with "MM/dd/yyyy" then it is very simple .
just follow this step
1. create 1 class name is Convert.
2. now enter one function GetDate
hear is source.
Public Shared Function Getmydate(ByVal code As System.String) As String
Dim ldate, ldate1, ldate2, ldate3 As String
ldate = code
ldate1 = Mid(ldate, 1, 2)
ldate2 = Mid(ldate, 4, 2)
ldate3 = Mid(ldate, 7, 4)
ldate = ldate2 & "/" & ldate1 & "/" & ldate3
Return ldate
End Function
3. now use it in u r form
dim date1 as string
date1=Conver.getdate(datetimepicker.text)
bye
This post has been edited by aparichit00: 16 September 2009 - 12:31 AM
#10
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 18 November 2009 - 06:41 AM
try this
first you have to convert textbox valut into date then
dt.tostring("MM/dd/yyyy")
first you have to convert textbox valut into date then
dt.tostring("MM/dd/yyyy")
This post has been edited by nitinkhadloya: 18 November 2009 - 06:42 AM
#11
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 18 November 2009 - 06:54 AM
Hi,
Easiest is
Easiest is
TextBox1.Text = Format(CDate("15-01-2009"),"MM/dd/yyyy")
#12
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 18 November 2009 - 10:09 AM
PsychoCoder's code is the simplest if you look closer.
#13
Re: How to convert textbox value date from dd/MM/yyyy to MM/dd/yyyy in vb.
Posted 19 November 2009 - 03:19 AM
Sure but it requires an extra sub...
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|