I need to take System.DateTime.Now and have the resulting text be in the
following format:
yyyyMMddhh24mmsss
I am using System.Convert.ToString(System.DateTime.Now), but I need to
format it correctly, what is the easiest way to accomplish this? 3 9847
Eric,
I assume by
yyyyMMddhh24mmsss
What you really mean is four digit year, two digit month, two digit day,
two digit hour (in military time), two digit minute, two digit second (I
dont know what the third s is for). All digits will have a trailing zero,
if necessary.
Your pattern is:
yyyyMMddHHmmss
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Eric Stott" <eric@stottcreations_nospam.com> wrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl... I need to take System.DateTime.Now and have the resulting text be in the following format: yyyyMMddhh24mmsss I am using System.Convert.ToString(System.DateTime.Now), but I need to format it correctly, what is the easiest way to accomplish this?
Yes that is the pattern.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OY**************@TK2MSFTNGP04.phx.gbl... Eric,
I assume by
yyyyMMddhh24mmsss
What you really mean is four digit year, two digit month, two digit day, two digit hour (in military time), two digit minute, two digit second (I dont know what the third s is for). All digits will have a trailing zero, if necessary.
Your pattern is:
yyyyMMddHHmmss
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Eric Stott" <eric@stottcreations_nospam.com> wrote in message news:e9**************@TK2MSFTNGP04.phx.gbl...I need to take System.DateTime.Now and have the resulting text be in the following format: yyyyMMddhh24mmsss I am using System.Convert.ToString(System.DateTime.Now), but I need to format it correctly, what is the easiest way to accomplish this?
I guess Nicholas meant to say you have to use:
System.DateTime.Now.ToString("yyyyMMddHHmmss") ;
/LM
"Eric Stott" <eric@stottcreations_nospam.com> wrote in message
news:OS**************@TK2MSFTNGP03.phx.gbl... Yes that is the pattern. "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:OY**************@TK2MSFTNGP04.phx.gbl... Eric,
I assume by
yyyyMMddhh24mmsss
What you really mean is four digit year, two digit month, two digit day, two digit hour (in military time), two digit minute, two digit second (I dont know what the third s is for). All digits will have a trailing zero, if necessary.
Your pattern is:
yyyyMMddHHmmss
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Eric Stott" <eric@stottcreations_nospam.com> wrote in message news:e9**************@TK2MSFTNGP04.phx.gbl...I need to take System.DateTime.Now and have the resulting text be in the following format: yyyyMMddhh24mmsss I am using System.Convert.ToString(System.DateTime.Now), but I need to format it correctly, what is the easiest way to accomplish this?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gerrit Holl |
last post by:
Posted with permission from the author.
I have some comments on this PEP, see the (coming) followup to this message.
PEP: 321
Title: Date/Time Parsing and Formatting
Version: $Revision: 1.3 $...
|
by: McGiv |
last post by:
Hi,
I'm trying to serialise some objects and I've can't get the built in
serialisation to output exactly what I want. For the moment I'm
implementing the IXmlSerializable interface and doing it...
|
by: Lauchlan M |
last post by:
Hi
In an ASP.NET application, I am doing the following (dtrData is a data
reader that has been loaded with data already):
if (dtrData.Read())
{
lblEDPresentationTime.Text = (DateTime)...
|
by: darrel |
last post by:
I'm binding fileinformation to a repeater and attempting to display the
'lastWriteTime' property as a formatted date.
This:
<%# DataBinder.Eval(Container.DataItem, "LastWriteTime" %>
Gives...
|
by: Mark |
last post by:
I am running into a weird problem. I am using the following code:
String.Format("{0:0}:{1:00}:{2:00}", Hours.ToString, Minutes.ToString,
Seconds.ToString)
Just say seconds is set to 1, it...
|
by: TJ |
last post by:
Why doesn't this work?\
string _s = String.Format("{0:M/d/yyyy}","5/20/2005 12:00:00 AM);
Response.Write(_s);
It kicks back the full date and time...I just want the date to show and not
the...
|
by: Ken Wigle |
last post by:
All,
I would be very grateful for any help on this question. I have an
application in asp.net 2.0 where I dynamically create a datatable and then
bind that to a gridview. Unfortunately, the...
|
by: sherifffruitfly |
last post by:
Hi,
God I hate datetime string formatting...
How do I get a string of the form "04-Oct-2006", for example, from a
DateTime object?
Thanks a jillion,
cdj
|
by: Untitled |
last post by:
I have an application that stores all DateTime inforamtion in UTC.
However, this application will be accessed from arround the world. I
would like my users to be able to specify their prefered...
|
by: Tim |
last post by:
Folks,
I'm trying to format a print string so that it reports progress whilst
processing a looping structure with a date time stamp appended to the
end of the string. This started out life as a...
|
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...
|
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,...
|
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...
|
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,...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
| |