473,385 Members | 2,003 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.

Questions DateTime.Now

Hello.

How can I get only date or only time from DateTime.Now?
For example I want to assign current date and current time to some labels.

Thank you.
Nov 16 '05 #1
3 2128
On Sat, 11 Dec 2004 22:27:34 +0400, David wrote:
Hello.

How can I get only date or only time from DateTime.Now?
For example I want to assign current date and current time to some labels.

Thank you.


Format appropriately, or use one of the built in methods such as
DateTime.Now.ToShortDateString() and DateTime.Now.ToShortTimeString().
--
Tom Porterfield
Nov 16 '05 #2
Use DateTime.Now, but display the string as you need it (i.e. time only,
short data, long date, etc.)

--
William Stacey, MVP
http://mvp.support.microsoft.com

"David" <da*********@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Hello.

How can I get only date or only time from DateTime.Now?
For example I want to assign current date and current time to some labels.

Thank you.


Nov 16 '05 #3
David,
In addition to the other comments about formatting, which is probably what
you want as you to "assign to some labels".

In calculations: You can use DateTime.Date to get just the Date part of a
DateTime. You can use DateTime.TimeOfDay to get just the Time part of a
DateTime.

Hope this helps
Jay

"David" <da*********@hotmail.com> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Hello.

How can I get only date or only time from DateTime.Now?
For example I want to assign current date and current time to some labels.

Thank you.

Nov 16 '05 #4

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

Similar topics

1
by: Евгений Косенко | last post by:
Hi! I have several questions about the module datetime. The module has been added to Python 2.3. It seems that its interface is raw and dirty. Who is maintainer of the module? Who may answer...
6
by: Carl | last post by:
Hi, to be use with SQL server database 1- From window form textbox object From this assignement, txtTOTAL.Text="0.00m"; How do you convert back to decimal type ? How do you assign a...
2
by: Kevin | last post by:
Hi everybody. I am new to C#, I come from a VB 6 background, so there are some pretty big difference that I need to get used to, so please bear with me if my questions are simple. 1. In my...
3
by: WStoreyII | last post by:
I have a Collection Class That I am Creating , In This Collection Class I have a default Property Item. My Problem is this I have about twenty different Criterias that can be used as a value...
4
by: mflanagan | last post by:
I think I've figured out my interop problems, but I'd like some confirmation that I'm not going down the wrong path. I'm connecting to a web service over which I have no control, and it's...
4
by: jobs | last post by:
Three noob questions. Please help. 1. Is there a way to have arguments on subroutine that are optional? 2. Say I need to convert datetime to string..in this format : 2006-09-07...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
3
by: Dom | last post by:
Still teaching myself about SQLDataReader and associated classes. I have to say, the new HELP screens from MS are just about useless!! Let's assume I have just read some records from a table...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.