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

Getting the current time and format it to an own format ?

I would like to get the current time(stamp) (including the milliseconds)
and assign it into a string variable with a format like:

xxxx mytime = getcurrentsystemtime();
string mytime = reformatto("yyy.mm.dd HH:MM:SS:MSMS", mytime);

How do I do this ? The hours should be displayed in 24h mode

Mark

May 25 '07 #1
2 2560
On May 25, 8:37 am, m.popp...@lycos.com (Mark Poppers) wrote:
I would like to get the current time(stamp) (including the milliseconds)
and assign it into a string variable with a format like:

xxxx mytime = getcurrentsystemtime();
string mytime = reformatto("yyy.mm.dd HH:MM:SS:MSMS", mytime);

How do I do this ? The hours should be displayed in 24h mode

Mark
Dear Mark,

Use DateTime.Now.ToString() overloads to format the current system
time.

To Convert the current time to other datetime formats (such as UTC)
use the DateTime.Now.To* method family.

Hope this helps.
Moty

May 25 '07 #2
string myTime = DateTime.Now.ToString("yyyy.MM.dd
HH:mm:ss:ffff");
Console.WriteLine(myTime);

Mark Poppers je napisao/la:
I would like to get the current time(stamp) (including the milliseconds)
and assign it into a string variable with a format like:

xxxx mytime = getcurrentsystemtime();
string mytime = reformatto("yyy.mm.dd HH:MM:SS:MSMS", mytime);

How do I do this ? The hours should be displayed in 24h mode

Mark
May 25 '07 #3

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

Similar topics

1
by: Sara Khalatbari | last post by:
Is there a Modules in Python that returns the time & date of today when ran?
9
by: deko | last post by:
What is it with these dates? What are they so much trouble? All I want to do is subtract an hour, but not if that makes dtmTest less than dtmClt. Dim dtmStart As Date Dim dtmEnd As Date Dim...
3
by: Ilja Booij | last post by:
Hi all, I have some trouble with the following: I'm getting a time string, in YYYY-MM-DD HH:mm:ss format, which I need to translate into a string with DD-Mon-YYYY HH:mm:ss +HHMM, where the...
3
by: Atul | last post by:
Hi, I am running .NET Framework 2.0 on windows XP SP2. I am stuck in a situation where I need to find out a list of all active sessions running in IIS for a web application. I know that .NET...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
10
by: Paul H | last post by:
I am trying to get the spec for a database. The trouble is the client frequently blurts out industry jargon, speaks insanely quickly and is easily sidetracked. They are currently using around 30...
8
by: simonlpwaters | last post by:
I need to obtain the username of the currently logged in user on a machine. However, the program that needs to do this will be running under different credentials to the logged in user, so using...
4
by: wolverine | last post by:
Hi, I want to get gmt in the format "MM/DD/YY HR:MIN:SEC". I have written the following code. Could any one of you suggest a better way ? var localTime = new Date(); var utc =...
29
by: WannabePrgmr | last post by:
I am trying to display total numbers of data in a textbox, "Textbox200" on a form "Master", but I only want to display current daily data. I currently get the data from: Me.Text200 = DCount("",...
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
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
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
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,...
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.