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

date comparison prblm

Hi All,
I am having prblm in comparing date, I have to pass a date and if the date is a past date compared to today's date I have to notify..
this is urgent plz reply.
The format is mm/dd/yyyy but the today's date is coming in a detail format i.e with time...
Jun 28 '07 #1
3 1297
epots9
1,351 Expert 1GB
try this:
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
var myDate = curr_month + "/" + curr_date + "/" + curr_year;
of course u'll have to change it to make it work with your code.
Jun 28 '07 #2
try this:


of course u'll have to change it to make it work with your code.
HI epots9,
Thanx for the help, but there's a little change in it..
it


Expand|Select|Wrap|Line Numbers
  1. var d = new Date();
  2. var curr_date = d.getDate();
  3. [b]var curr_month = d.getMonth() +1;
  4. var curr_year = d.getFullYear();
  5. var today = curr_month + "/" + curr_date + "/" + curr_year;
Jun 28 '07 #3
acoder
16,027 Expert Mod 8TB
HI epots9,
Thanx for the help, but there's a little change in it..
it


Expand|Select|Wrap|Line Numbers
  1. var d = new Date();
  2. var curr_date = d.getDate();
  3. [b]var curr_month = d.getMonth() +1;
  4. var curr_year = d.getFullYear();
  5. var today = curr_month + "/" + curr_date + "/" + curr_year;
Yes, don't forget the +1 for the month (it's zero-based)
Jun 29 '07 #4

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

Similar topics

16
by: Donnal Walter | last post by:
I was very surprised to discover that >>> import datetime >>> x = datetime.date(2004, 9, 14) >>> y = datetime.datetime(2004, 9, 14, 6, 43, 15) >>> print x == y True How can these two...
2
by: Scott Knapp | last post by:
Good Day - I have a form which sets the current date, as follows: <script type="text/javascript"> xx=new Date() dd=xx.getDate() mm=xx.getMonth()+1 yy=xx.getYear() mmddyy=mm+"/"+dd+"/"+yy...
3
by: Karl Gibbon | last post by:
Hi There, I currently have a database in Access 2002 with several forms. I would like to restrict access to one form in perticular until November 1st every year. My current method (attempted...
6
by: MarkAurit | last post by:
Im having difficulty coming up with a good algorithm to express the following comparison: "if <a given date> falls between the (current date - 5 days) and the (current date)" Obviously....
3
by: sudheer dacha via .NET 247 | last post by:
When iam including System.Management Namespace and working with it its raising an error : Invalied Namespace. Its working fine on one system and when the same application is being executed on...
3
by: Tiya | last post by:
Hi there !!! I would like to know how to compare dates in javascript. var sdate = new Date(theform.SubmissionDate.value); var odate = new Date(theform.StartDate.value); var todaysdate = new...
4
by: blini | last post by:
Helo.... How I can convert string "26/03/2006 15:51" for a date? I need to convert and to compare if "09/06/2006 14:20" is lesser or equal that the current date. Everything in Javascript.
4
by: nagarwal | last post by:
Hi All, I am having prblm in adding the no. of days passed to the current date, in a class fuction. This is an immediate requirment plz help.. I am using java.util.Date object for the current...
4
by: anagai | last post by:
I just want to check if a date entered in a textbox is equal to the current system date. I set the date object from the input field like this: dt1=new Date('10/01/2007'); the current system...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
0
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...

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.