473,385 Members | 1,890 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.

String as Datetime

Hello.
How can I specify datetime by string?
In VB.NET I can write by "#" simbol like this: #10/12/2004 12:00#.
How can I do it in C#?
Nov 16 '05 #1
5 6034
I dont know exactly your mean

But you can show information in this MSDN sit

http://msdn.microsoft.com/library/de...ringtopic17.as
_____________________
Have a Good Day
_____________________
Mail :le*****@korea.co
MSN :le*****@Korea.co
Tel. :33-1-7142-640
_____________________
http://leehack.sarang.net
Nov 16 '05 #2
msnews.microsoft.com wrote:
Hello.
How can I specify datetime by string?
In VB.NET I can write by "#" simbol like this: #10/12/2004 12:00#.
How can I do it in C#?

Try this:

string theTime = "10/12/2004 12:00";
DateTime dt_theTime = DateTime.Parse(time);

Hopfully it works well.
Greetings
Sergej
Nov 16 '05 #3

try the DateTimeConverter class in the
System.ComponentModel namespace
-----Original Message-----
Hello.
How can I specify datetime by string?
In VB.NET I can write by "#" simbol like this: #10/12/2004 12:00#.How can I do it in C#?
.

Nov 16 '05 #4
check this it should be work
in C#
string strdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
"msnews.microsoft.com" <da*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello.
How can I specify datetime by string?
In VB.NET I can write by "#" simbol like this: #10/12/2004 12:00#.
How can I do it in C#?

Nov 16 '05 #5
I don't think that what you want to do is possible. I don't believe
there is a syntax for representing a date time as a string in code. You
will have to create a string, and then actually execute code to change it
into a DateTime, as others have indicated.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"msnews.microsoft.com" <da*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello.
How can I specify datetime by string?
In VB.NET I can write by "#" simbol like this: #10/12/2004 12:00#.
How can I do it in C#?

Nov 16 '05 #6

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

Similar topics

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...
38
by: nobody | last post by:
I know that given a FormatString and a DateTime you can use DateTime.ToString(...) to convert the DateTime to a String. My question is how can you turn that around? Given a String and a...
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
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
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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:
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...
0
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
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
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...

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.