473,698 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting date in string format to date format

2 New Member
i have a problem with date
i have two dates. one is in Date type and the other one is in String type.
i need to compare these two dates.
for this i try to convert date which is in String type to Date type.is it possible?
how?could you suggest the logic and methods?
May 16 '07 #1
4 3337
sateesht
41 New Member
Hi

Below is the Code which Converts String to Date Format:

String str="2007050816 4500";
SimpleDateForma t dateFormat=new SimpleDateForma t("yyyyMMddHHmm ss");
ParsePosition p=new ParsePosition(0 );
Date date=dateFormat .parse(str,p);
System.out.prin tln(date);




Cheers,
Sateesh.
May 16 '07 #2
JosAH
11,448 Recognized Expert MVP
Have a look at the SimpleDataForma t class and pay special attention to
its parse method. The return value of that method is a Date.

kind regards,

Jos
May 16 '07 #3
santoshsri
48 New Member
Hi ,

I will have to convert Currency string into number format ..Please let me know how to do this.

For example : I will have to format $32,000.00 as 32000 in C# .
May 23 '07 #4
JosAH
11,448 Recognized Expert MVP
Hi ,

I will have to convert Currency string into number format ..Please let me know how to do this.

For example : I will have to format $32,000.00 as 32000 in C# .
You're hijacking the wrong thread in the wrong forum; please ask your question
in the C# forum; this is a Java forum.

kind regards,

Jos
May 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
15541
by: Kim Hellan | last post by:
I have a simple string in the format "DD-MM-YY hh:mm:ss", that I need to convert to a DateTime value. I know this is a standard problem, but please don't just link to all the MSDN pages regarding Parse() and ParseExact(). I've been there and read all the information about using IFormatProviders, DateTimeStyles, CultureInfo....... Bottom line is that I can't get it working, so could someone please just post 5-10 lines of working code...
8
2485
by: Mika M | last post by:
Is there better way to convert integer type date into DateTime type date as doing like code below? Dim intDate As Integer = 20051019 Dim dte As DateTime = New DateTime( _ CType(intDate.ToString.Substring(0, 4), Integer), _ CType(intDate.ToString.Substring(4, 2), Integer), _ CType(intDate.ToString.Substring(6, 2), Integer))
14
3396
by: eric.goforth | last post by:
Hello, I'm trying to convert a string to a date time in a C# web service. I'm passing in a string parameter and I have a localization setting in my Web.config file: My app is blowing up on the first line here, with a"Value does not fall within the expected range" error.
12
2599
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for example: 21/05/2006
9
12942
by: Alok yadav | last post by:
i am using a webservice in which a method is serach. i use this method which accept a argument of date type in dd/MM/yyyy formate. i have a textbox which accept the date from the user, when i convert textbox data into Datatime formate it converted into MM/dd/yyyy formate, but i have a requirement in dd/MM/yyyy formate. please help me, i am using c#.
6
34090
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
5
1968
by: c_shah | last post by:
I have a string in this format 100106 what is the most efficient way to convert it to a date like 10/01/2006 thanks.
2
11175
by: Brian Parker | last post by:
I am beginning to work with VB2005.NET and I'm getting some problems with string formatting converting an application from VB6. VB6 code:- sTradeDate = Format(pArray(4,i Record), "mmddyy") pArray is a variant array containing a date string at pArray(4, iRecord) in the format "yyyy/mm/dd"
3
7155
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying to autoformat the contents of text entries in a GUI. For numbers, I'm converting the text representation to the appropriate type (using atoi, atof, ...) and converting the result back to text with the correct format (using sprintf). But this does...
2
4726
by: stainless | last post by:
I know this is probably simple but I cannot find a method of converting a date string into a format that matches the DatePicker format in C# eg string "20080131" converted to "31 January 2008" I tried datetime.parseexact but could not find the definition for the appropriate format string. This would be a very useful tool fo me. Any ideas,please?
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8610
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
9031
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6528
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
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.