473,804 Members | 3,802 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateDiff() quick question

12 New Member
You guys have been life savers for me, and I appreciate your help so much.

I am trying to check the difference in days between two submitted requests.

Expand|Select|Wrap|Line Numbers
  1. DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
  2. Date firstDate = df.parse(firstRequest);
  3. Date secondDate = df.parse(secondRequest);
  4. int requestDays = DateDiff(dd, firstDate, secondDate);
  5.  
I get an error that dd can not be resolved.
I tried "DD" and got DateDiff(String , Date, Date) is undefined
I tried Calendar.DATE and got DateDiff(int, Date, Date) is undefined

What do I need to add to make this work?

Thanks again for all your help.

Brita
Oct 26 '07 #1
4 3971
r035198x
13,262 MVP
You guys have been life savers for me, and I appreciate your help so much.

I am trying to check the difference in days between two submitted requests.

Expand|Select|Wrap|Line Numbers
  1. DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
  2. Date firstDate = df.parse(firstRequest);
  3. Date secondDate = df.parse(secondRequest);
  4. int requestDays = DateDiff(dd, firstDate, secondDate);
  5.  
I get an error that dd can not be resolved.
I tried "DD" and got DateDiff(String , Date, Date) is undefined
I tried Calendar.DATE and got DateDiff(int, Date, Date) is undefined

What do I need to add to make this work?

Thanks again for all your help.

Brita
Use the GregorianCalend ar. It has methods that can do what you want. Just open the API specs for it and see.
Oct 26 '07 #2
Brita
12 New Member
Use the GregorianCalend ar. It has methods that can do what you want. Just open the API specs for it and see.
Thanks! I used the GregorianCalend ar like you suggested and it works just fine.

I still am a little confused by DataDiff() though. Is this a standard Java Function? If not why do I keep seeing it everywhere?

Thanks again.

Brita
Oct 26 '07 #3
r035198x
13,262 MVP
Thanks! I used the GregorianCalend ar like you suggested and it works just fine.

I still am a little confused by DataDiff() though. Is this a standard Java Function? If not why do I keep seeing it everywhere?

Thanks again.

Brita
Tell you the truth I've just started to see it now in your code.
One thing is certain. It's not a standard Java function.
It's probably a method someone wrote in some Date utils class of theirs.
Oct 26 '07 #4
Brita
12 New Member
Tell you the truth I've just started to see it now in your code.
One thing is certain. It's not a standard Java function.
It's probably a method someone wrote in some Date utils class of theirs.
You are probably (certainly) correct.

Thanks again for your help. This is such a great resource. Hopefully, one day I will know enough to help others here.

Brita
Oct 26 '07 #5

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

Similar topics

1
1680
by: jack | last post by:
I pulled this script out of a larger one to test, and I can't figure it out. If I keep this script in the same directory as the files I want to read, it works fine, but if I move the script out of it, no dice. Am I missing something? Thanks Being script: #!/usr/bin/perl
10
1492
by: Snake | last post by:
Hello guys, I have a quick question about pointers. When I say int *p; *p = 40; cout << *p; why does that produce and error message(something about fault address)? Isnt that I created a pointer and I made it point to the value of 40 and then display it?! Thanx alot,any help is really appreciated
30
1959
by: Christopher Benson-Manica | last post by:
Given the following: char s="Hello, world\n!"; Are all the following guaranteed to produce the same output? printf( "%s", s ); fprintf( stdout, "%s", s ); fwrite( s, sizeof(char), sizeof(s)/sizeof(char) - 1, stdout );
5
1891
by: tariq | last post by:
Hi, got a quick question on al.exe i have an assembly say library.dll without any strong name i have a sn pair say org.snk how do i sign library.dll with org.snk using al? tx -T
1
283
by: Mike | last post by:
Hi, I am using an enum to map to certain columns instead of using the string name. When I use the enum as the indexer in a datarow it forces me to cast it into an int. Shouldn't this be automatic at design time? See code below: private enum DataIndexer { OrderID,
6
3593
by: z_learning_tester | last post by:
Quick question- What happens if you have a private class with a public static method? Can you still say the following? Lets say you are making this call from another class, say class2... int myVal = class1.method(); It seems that you should not be able to, after all from class2, you should not be able to see the private class1, so it's public static method is effectively wasted.
2
1109
by: Rudy | last post by:
Hello all! Have a quick question on drop down list. Need to make a year ddl, 1900 to 1987. Is there a quick way to do this. I'm not binding this, just loading it in the items collection. Thanks!!! Rudy
3
1726
by: Brian | last post by:
A quick question here - What can be achieved in IL which is not possible in C# ? o Creation of an ArrayList o Creation of a Dictionary o Creation of a two dimensional array o Creation of a non-zero based array Please let me know what is the right answer. Many thanks.
1
1265
by: JustTrev | last post by:
Hi I have a quick question. I'm studying how XML works in sq server 2005, and I've hit the following code online that I can't completely understand (see below code). I know what it does, how it works, but it's just the part "AS feed (xmlData)" that I'm trying to fully understand. I get the 'As feed' is an alias,but why must the (xmlData) be there? If anyone can answer this (i'm asuuming simple question!) I would greatly appreciate it. ...
0
9577
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
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
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
10315
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5519
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
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
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.