473,407 Members | 2,312 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,407 software developers and data experts.

string to formated datetime

how can I convert a string like this "10/04" meaning octuber/2004 to a valid
DateTime?
Nov 19 '05 #1
2 997


"Alejandro Penate-Diaz" wrote:
how can I convert a string like this "10/04" meaning octuber/2004 to a valid
DateTime?

CDate function:

http://msdn.microsoft.com/library/de...vsfctcdate.asp

Check the parameters that CDate is expecting. You may need to do some text
parsing and string manipulation before calling CDate.
Nov 19 '05 #2
You will use the .ParseExact method of DateTime.

Dim dt as DateTime
dt = DateTime.Parse( "10/04", "MM/yy" )

DateTime dtC = DateTime.Parse( "10/04", "MM/yy" );

HTH,

bill

"Alejandro Penate-Diaz" <al********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
how can I convert a string like this "10/04" meaning octuber/2004 to a valid DateTime?

Nov 19 '05 #3

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

Similar topics

7
by: Henri Schomäcker | last post by:
Hi folks, I got a windows com executable which returns a jpg image in a BSTR. Let's say, the var that holds the data is $imgData. With perl, in a cgi script, I may simpy write:...
16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
2
by: Sterling Ledet | last post by:
I am trying to create a web service that takes a string from my web server in the following format: Mon, 6 Oct 2003 18:39:47 UTC and put's in a datetime so it can then be reformatted in C# as...
6
by: Rookie Card | last post by:
I know this is a very common issue but cannot find a thread that resolves the issue. I need to re-format my dates to "MMM d, yyyy". The problem I have is I have an MSSQL database that allows...
2
by: Pat Brown | last post by:
I am pulling an integer value of the amount of seconds since 12:00 am from a SQL Server DB. I want to convert this integer into a formated string or datetime to display a legible time of day. Are...
7
by: bojan.pikl | last post by:
Hi, I am making a calculator. I have a double wich I am parsing to string and writing to label. How could I make that double or string would be only 14 length + space for negative sign (-). So I...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
1
by: dizzy77 | last post by:
A have a TextBox binded to DateTime type field and I would like the output to be formated as for example: 20/10/2007 This code below does that but it uses dots for separation: 20.10.2007...
2
by: Nikola Skoric | last post by:
I have been trying to find appropriate way to do get local time in "yyyy-mm-dd hh:mm:ss" format, but the best I got is this: datetime.datetime.fromtimestamp(time.mktime(time.localtime())) It seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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...
0
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...

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.