473,811 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing seconds from System.DateTime .Today.Now

i use the following code to display date and time of system
System.DateTime .Today.Now

but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also

thank you
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
Sep 22 '07 #1
2 10690
Pure Heart wrote:
i use the following code to display date and time of system
System.DateTime .Today.Now

but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also
I assume you are implicitly converting to a string. Check DateTime.ToStri ng(
string )

http://msdn2.microsoft.com/en-us/library/zdtaw1bw.aspx

Regards,

Mads

--
Med venlig hilsen/Regards

Systemudvikler/Systemsdevelope r cand.scient.dat , Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCente r A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34
Sep 22 '07 #2
Pure Heart wrote:
i use the following code to display date and time of system
System.DateTime .Today.Now
That would be System.DateTime .Now
but it displayes seconds also haw can i make it display date and time
without seconds

and haw can it display time only with no date and without seconds also

thank you
Specify a format when you convert the DateTime into a string. Example:

DateTime t = DateTime.Now;
String time = t.ToString("HH' :'mm");

--
Göran Andersson
_____
http://www.guffa.com
Sep 22 '07 #3

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

Similar topics

2
2625
by: Noud Aldenhoven | last post by:
Hello everyone, I was wondering how to remove comments away form a file. So that's why I made this script. =============================== #!/usr/bin/env python import sys import string
3
12832
by: nriesch | last post by:
In the documentation, the "Second" property of class DateTime is a value between 0 and 59. In UTC time, approximately every year of so, a leap second is added at 00:00:00 UTC, so as to account for the irregular rotation of the earth, which is slowing down a little bit. So, a minute can contains 61 seconds ( range 0..60 ). Besides, the NTP protocol takes leap second into account, and UTC time also.
13
367
by: bredal Jensen | last post by:
Hello gurus, I'm building a small booking system and i have come accross quiet a tedious pitfall. "I need to make sure that people do not book for tomorrow when todays time is greater or equal to 11."
3
3524
by: Barney | last post by:
in my db i have the time as seconds, 3600, 1800, etc. how can i convert that to the actual time and display it as 1:00 AM, etc? thx
15
22183
by: Snuyt | last post by:
Hello, I want the program to wait a few seconds between executing code. It should look something like this: public sub xx() ...code... wait(2) 'wait 2 seconds ...code...
5
12420
by: james | last post by:
Banging my head here. I have an older Database that I have imported to Access and the original database system (Dataflex) stored the Time of Day in Seconds. I can use :TimeSpan.FromSeconds(74400),, to get a time of: 20:40 (24hr time). I need to get 8:40 PM . But, looking thru all the different methods of TimeSpan I cannot find how this is done short of writing a routine that looks at the Hours and Seconds to determine AM/PM . I also...
2
28061
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 there any built in methods in the .NET framework that will accomplish this. If not, any other suggestion about creating a method to do this would be appretiated. Thanks
2
5378
by: flaper87 | last post by:
Hi everybody!!!! I am developing an aplication, and i want it to stay on the system tray, i found out how to put the icon, but i can minimize it there, What do i have to do?, I'm using python(of course). and this is the code: # -*- coding: iso-8859-1 -*- # Don't modify comment import wx
2
3526
by: Richard Rossel | last post by:
Hi friends, I need a little help here, I 'm stuck with epoch calculation issue. I have this datetime: date_new = datetime(*time.strptime('20080101T000000','%Y%m%dT%H%M%S') ) This date_new is in UTC Now I need to know the seconds since epoch of this new date, so I run this: seconds = int(time.mktime(date_new.timetuple())) but the seconds returned belongs to :
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.