473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with date format

Hello,

I have a TextBox1 binds to dateEnterred as datetime. My system date format
is m/d/yy. When I gave the value as string, "04/18/2008" to the
TextBox1.Text, it changed to "41/8/08".

Without changing the Date Format on the system and maintaining the datetime
datatype for dateEntered, how can I make the TextBox1.Text to bind value
"04/18/2008" instead of "41/8/08".
Thank you,

Phien-An

Jun 27 '08 #1
5 1030
try the .ToString method of datetime type:
datetime.ToString(format as string)

in case, datetime.ToString("MM/dd/YYYY")
Thiago
Jun 27 '08 #2
On 16 abr, 16:03, Thiago Macedo <thiago.ch...@gmail.comwrote:
try the .ToString method of datetime type:
datetime.ToString(format as string)

in case, datetime.ToString("MM/dd/YYYY")

Thiago
I think this article will help you:
http://www.codeproject.com/KB/cs/String2DateTime.aspx
Jun 27 '08 #3
On Apr 16, 8:41 pm, "Phien-An Nguyen" <onok...@gmail.comwrote:
Hello,

I have a TextBox1 binds to dateEnterred as datetime. My system date format
is m/d/yy. When I gave the value as string, "04/18/2008" to the
TextBox1.Text, it changed to "41/8/08".

Without changing the Date Format on the system and maintaining the datetime
datatype for dateEntered, how can I make the TextBox1.Text to bind value
"04/18/2008" instead of "41/8/08".

Thank you,

Phien-An
Hi,
DateString can provide you date omitted with hyphens "-", then you can
easily replace hyphens to slashes that matches your visiual desire.
So, place textbox named "textbox1" then here is your solution:

TextBox1.Text = DateString.ToString
TextBox1.Text = TextBox1.Text.Replace("-", "/")

Hope this helps,

Onur Güzel
Jun 27 '08 #4
Don't forget that there is a difference between lowercase m and uppercase M
on the date/time format. Looks like you had it using Minutes instead of
Months.
"Phien-An Nguyen" <on*****@gmail.comwrote in message
news:eI****************@TK2MSFTNGP03.phx.gbl...
Hello,

I have a TextBox1 binds to dateEnterred as datetime. My system date
format is m/d/yy. When I gave the value as string, "04/18/2008" to the
TextBox1.Text, it changed to "41/8/08".

Without changing the Date Format on the system and maintaining the
datetime datatype for dateEntered, how can I make the TextBox1.Text to
bind value "04/18/2008" instead of "41/8/08".
Thank you,

Phien-An
Jun 27 '08 #5
Mark,

In my idea you hit this one,

Cor

"Mark" <tr**********@fuse.netschreef in bericht
news:eT****************@TK2MSFTNGP02.phx.gbl...
Don't forget that there is a difference between lowercase m and uppercase
M on the date/time format. Looks like you had it using Minutes instead of
Months.
"Phien-An Nguyen" <on*****@gmail.comwrote in message
news:eI****************@TK2MSFTNGP03.phx.gbl...
>Hello,

I have a TextBox1 binds to dateEnterred as datetime. My system date
format is m/d/yy. When I gave the value as string, "04/18/2008" to the
TextBox1.Text, it changed to "41/8/08".

Without changing the Date Format on the system and maintaining the
datetime datatype for dateEntered, how can I make the TextBox1.Text to
bind value "04/18/2008" instead of "41/8/08".
Thank you,

Phien-An
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2909
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
3
2030
by: Alicia | last post by:
Hi, I am trying to match two queries and make it into one query. I have only been about to group similar attributes but nothing that looks like the FinalQuery below. If anyone knows of a query...
5
1909
by: Alicia | last post by:
Hello everyone based on the data, I created a union query which produces this. SELECT ,,, 0 As ClosedCount FROM UNION SELECT ,, 0 AS OpenedCount, FROM ORDER BY , ;
4
8896
by: Anon | last post by:
Hello All! I have written a simple app that auto downloads a file from a secure ftp, renames it, and moves it to a network location. Everything works great except the renaming part. I parse out...
4
2735
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last...
2
2066
by: Bill | last post by:
I have a 200 record database that includes a date/time field, AnnivDate, for a wedding anniversary. AnnivDate has nulls and some incorrect year data. I have been creating the Access database...
9
3923
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
2
3135
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
4
4637
xstatic
by: xstatic | last post by:
After searching through the hundreds of links about "Javascript Date Formatting", all I am finding is how to format dates that gives a "current date" result. Here is what I need... I have a...
2
1446
matrekz42
by: matrekz42 | last post by:
Hello friends, I'm trying to run this Dynamic SQL in VB, but I keep getting "Compile Error" Syntax Error, in the "Bolded" area. I'm only trying to change these fields for the second query listed,...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.