Jump to content

check date time value is null


Recommended Posts

I need to assign a date time value from url, if is is null or does not exist then I want to assign current date, if the value exists then I need assign the value from url.


I use the following code and try to use MyDate.tostring().length ==0), but it seems that Javascript does not recognize the equation,


Any information is great appreciated,






if (MyDate.tostring() === "") { MyDate = new Date(); }; if (MyTime.tostring() === "" ) { MyTime = new Date(); };

Link to comment
Share on other sites

you'll have to provide a lot more information than that. Where do all those variables come from? Are you checking for errors in the console? What debugging are you doing to confirm the values of these variables?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...