473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Date Format to 2008-08-06

Doing this in VB.NET

I have a Textbox1 with a date like 8/6/2008. I have a Label1 that I want to
show the date as 2008-08-06. Can someone help me convert this?
Aug 14 '08 #1
2 832
DateTime.ToString("yyyy-MM-dd")

"pvong" <phillip*at*yahoo*dot*comwrote in message
news:e6**************@TK2MSFTNGP05.phx.gbl...
Doing this in VB.NET

I have a Textbox1 with a date like 8/6/2008. I have a Label1 that I want
to show the date as 2008-08-06. Can someone help me convert this?
Aug 14 '08 #2
"pvong" <phillip*at*yahoo*dot*comwrote in message
news:e6**************@TK2MSFTNGP05.phx.gbl...
Doing this in VB.NET

I have a Textbox1 with a date like 8/6/2008. I have a Label1 that I want
to show the date as 2008-08-06. Can someone help me convert this?
Dim dtmDate As DateTime = DateTime.ParseExact(Textbox1.Text, "M/d/yyyy",
Nothing);
Label1.Text = dtmDate.ToString("yyyy-MM-dd")

N.B. "2008-08-06" is an ambiguous date format because it's not possible to
uniquely differentiate between the month and the day - depending where you
are in the world, this will be seen as 8th June. not 6th August. Use a
three-digit month instead.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 14 '08 #3

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

Similar topics

30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
4
by: gubbachchi | last post by:
Hi, I have an issue regarding the php date format. I choose the date from date-picker which is in the format date('Y-m-d') i.e. 2008-09-12, then I will store this date in the variable $date_id and...
8
by: yashiro | last post by:
Hello i Have a database in SQLserver. I am using php to connect to it and to retrieve data from that database. I have a table with a column (DATATIME) where i do : $result =...
1
by: Mtek | last post by:
Hi, We have a form where the user selects a date from a calendar, the date is in the format May 23, 2008. The date in the datebase is in the format 05212008. What we need to do is get the...
1
by: Yas | last post by:
Hello I've got the following Javascript for a web calendar popup that outputs the date in 4/24/2008 (m/d/yyyy). How can i modify it to output dd/mm/yyyy e.g. 24/04/2008. So all outputs are in...
5
by: shapper | last post by:
Hello, What is the Regex expression to validate a date time format as follows: dd-mm-yyyy hh:mm:ss An example: 20-10-2008 10:32:45
3
by: inglesp | last post by:
Hi everyone I've come across some perculiar behaviour in a little database app I'm making with Access. I have a form for users to create a filter for data that goes into a cross-tab query. One...
2
by: Dark223 | last post by:
hi. i'm using a vb calendar to insert a date in a user form, but i can't set the date format to dd/mm/yy . for example: if i use: Text1.Text = Format(Text1.Text, "dd/mm/yyyy")
14
by: | last post by:
Hi, I program in asp.net. I have a date in TextBox in format "dd/MM/yyyy". I would like to validate if the date is realy correct. I used RegularExpressionValidator with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.