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

Date Formats

anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley
Dec 1 '05 #1
2 4182
Ian,

You want to use this instead:

myDTFI.FullDateTimePattern = "yyyyMMdd HHmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd HHmmss",
myDTFI);

Note the capital H. This will interpret the hour as military time,
instead of am/pm.

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

"Ian Frawley" <ye**@yeah.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley

Dec 1 '05 #2

"Nicholas Paldino [.NET/C# MVP]" wrote in message

Hi Nicholas,

Bingo thats fixed me problem many many thanks.

Ian
Ian,

You want to use this instead:

myDTFI.FullDateTimePattern = "yyyyMMdd HHmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd HHmmss",
myDTFI);

Note the capital H. This will interpret the hour as military time,
instead of am/pm.

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

"Ian Frawley" <ye**@yeah.com> wrote in message
news:OW**************@TK2MSFTNGP12.phx.gbl...
anyone know how to get this working?

string ergggg = "20051201 162533";
DateTimeFormatInfo myDTFI = new CultureInfo( "en-Gb",
false ).DateTimeFormat;
myDTFI.FullDateTimePattern = "yyyyMMdd hhmmss";
DateTime switchdate = DateTime.ParseExact(datething,"yyyyMMdd hhmmss",
myDTFI);
string ace = switchdate.ToString();

--

Regards

Ian Frawley


Dec 1 '05 #3

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

Similar topics

8
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 $...
3
by: praba kar | last post by:
Dear All, I have doubt regarding date string to time conversion function. In Python I cannot find flexible date string conversion function like php strtotime. I try to use following type...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
4
by: Matteo | last post by:
Hy everybody. I'm not a html writer, but a sysadmin who's trying to help a user able to compile an online form with IE but not with Mozilla (Moz1.6, Ns7.1, Firefox 0.8+) due to a javascript date...
36
by: Martin Herrman | last post by:
Dear scripters, I am working on a HTML form in which a date must be entered of the form 'dd-mm-yyyy'. Now I'm looking for a script that, when the user switches to another form field, changes...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
3
by: Leo Muller | last post by:
Hi, Very often I have a problem with date formats. There are cases I have to cast the date to text and from text to date on a different server. However, sometimes the date formats on the servers...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
9
by: SOLVER | last post by:
Hi, I can't figure out why this is not working propelly: date("d.m.Y",strtotime("05/03/2008 00:00:00")); result: 03.05.2008 date("d.m.Y",strtotime("18/05/2008 00:00:00")); result:...
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: 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
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
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
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,...

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.