Hello,
I am trying to write a program which as part of it has to check if one date occured before or after the current date. I already have the part that returns the before/after date in YYYYMMDD format (since 20070412 would be larger then 20070406). Now I need to get the system date in this format.
If I were to be able to get the system date in this format, as a string or an int, I could then run the program:
if currentDate %26gt; userDate
{
statusLabel.setText("Your date has already happened")
}
else
{
statusLabel.setText("Your Date has not yet happened")
}
That is not the actual program, just a demo of it.
How do I retrive date in Java in YYYYMMDD format?
how about something like:
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(year + "" + month + "" + day)
you could probably add more to it to display the date as 0306 but that is a quick and easy way
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment