PC Review


Reply
Thread Tools Rate Thread

How to convert user-defined custom format date string to date value

 
 
abcabcabc
Guest
Posts: n/a
 
      19th Aug 2005
I write an application which can let user define own date format to input,
How to convert the date string to date value with end-user defined date
format?

Example, User Defined Date Format as "dd/MM/yyyy"

input as "01082003" convert to date value as, 01 Aug 2003

Example, User Defined Date Format as "yyyy,dd,MM"

input as "2004,03,30" convert to date value as, 30 Mar 2004

Example, User Defined Date Format as "MM dd yyyy"

input as "05 07 2005" convert to date value as, 07 May 2005

Assumption: I cannot change regional language settings, because some PCs may
also use by several users whom have use own faviour date format.


 
Reply With Quote
 
 
 
 
Dragon
Guest
Posts: n/a
 
      19th Aug 2005
Hi,

This should work:

~
DateTime.ParseExact(InputString, UserDefinedFormat,
Globalization.DateTimeFormatInfo.InvariantInfo)
~

HTH

Roman



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Date string to date format Joe M. Microsoft Excel Misc 7 6th May 2010 02:46 PM
convert date from string to date format Howard - JC Publishing Microsoft Excel Discussion 3 9th Apr 2008 08:20 PM
Convert a non date string to date format Waheeda Ali Microsoft Access Queries 3 3rd Jan 2008 09:24 PM
Convert VB6-style Date Format string to VB2005-style Date Format string? \(O\)enone Microsoft VB .NET 2 9th Jul 2007 02:21 PM
How to convert a date string to datetime value with custom date format? ABC Microsoft C# .NET 1 29th Sep 2005 11:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:23 AM.