English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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 > 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.

2007-03-06 04:12:49 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

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

2007-03-06 04:31:03 · answer #1 · answered by Pitchy 5 · 0 0

fedest.com, questions and answers