473,395 Members | 1,411 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,395 software developers and data experts.

how do I Write a line of code to declare and construct a Date object named curDate.

Write a line of code to declare and construct a Date object named curDate.
Mar 22 '08 #1
1 1286
Ganon11
3,652 Expert 2GB
How do you declare an integer?

Expand|Select|Wrap|Line Numbers
  1. int myIntVariable;
If you want this variable to have a value, you would initialize it like so:

Expand|Select|Wrap|Line Numbers
  1. int myIntVariable2 = 5;
Now, an object reference is just like any other variable. So, if the class is named Date, and you want your variable name to be curDate, you say:

Expand|Select|Wrap|Line Numbers
  1. Date curDate;
That takes care of the declaration. The construction is like initializing the integer variable, but the syntax is a little different:

Expand|Select|Wrap|Line Numbers
  1. Date curDate = new Date();
This also has a different name - it is called instantiation, and we call curDate an instance of the Date class.
Mar 22 '08 #2

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

Similar topics

3
by: todd | last post by:
i have a site that displays shows. i am getting my date from a mysql function "CURDATE()" but it give me the date one day ahead of the actual date. i tried $myrow -1 but that doen't work. im sure...
2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
1
by: John Rappold | last post by:
I've Googled this, but can't find an answer to my problem. When a user selects a page with the recordset I want it to list dates that fall into a certain range, related to CURDATE(). The range...
2
by: G | last post by:
If one was to calculate say ten days ahead from a certain date but did not want to include the weekdays in this count, what formula would i use in my query column heading? thanks.
3
by: The One | last post by:
Have created a form to pop up with 2 option I then wish to write the text that is in the option button chose back to the original form using the code below but it gives me an exception error so...
11
by: B-Dog | last post by:
This has to be so simple, I'm trying to build a select query using OLEDB adapter using Jet 4.0 that only selects records with today's date. In access =Date() works great but of course it doesn't...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
3
by: jessDMiller | last post by:
I need to output data for today and the following week. Here is what I have: // Get all the data from the table $result = mysql_query("SELECT * FROM $table where curdate() >= day AND...
2
gregerly
by: gregerly | last post by:
I have posted this over at the MySQL forum with no responses, so I thought I might pick the brains of the PHP gurus... I'm having an issue with an SQL query. Heres what I have: 2 tables,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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,...
0
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...
0
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...

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.