Convert A Date Into Timestamp In JavaScript

Must Read : Convert A Date Into Timestamp In JavaScript

To get the unix timestamp using JavaScript you need to use the getTime() function of the build in Date object. As this returns the number of milliseconds then we must divide the number by 1000 and round it in order to get the timestamp in seconds.

Math.round(new Date().getTime()/1000);

To convert a date into a timestamp we need to use the UTC() function of the Date object. This function takes 3 required parameters and 4 optional parameters. The 3 required parameters are the year, month and day, in that order. The optional 4 parameters are the hours, minutes, seconds and milliseconds of the time, in that order.

To create the time do something like this:

var datum = new Date(Date.UTC('2009','01','13','23','31','30'));
return datum.getTime()/1000;

This prints out 1234567890. Here is a function to simplify things:

function toTimestamp(year,month,day,hour,minute,second){
 var datum = new Date(Date.UTC(year,month-1,day,hour,minute,second));
 return datum.getTime()/1000;
}

Notice that when adding in the month you need to minus the value by 1. This is because the function requires a month value between 0 and 11. However, there is an easier way of getting the timestamp by using the parse() function. This function returns the timestamp in milliseconds, so we need to divide it by 1000 in order to get the timestamp.

function toTimestamp(strDate){
 var datum = Date.parse(strDate);
 return datum/1000;
}

This can be run by using the following, not that the date must be month/day when writing the date like this.

 alert(toTimestamp('02/13/2009 23:31:30'));

Increase Import File Size Limit in phpmyadmin on wamp server

Must Read : Increase Import File Size Limit in phpmyadmin on wamp server

If you are using wamp server, you’ve noticed that wamp server by default allows only 2 MB sql file size to import. If you try to import large data you receive an error. So here is a very simple and easy solution to increase the file size limit in phpmyadmin.

We just need to change some values in php.ini file.  You can open this file through wamp server.

To php.ini file through windows explorer.
Goto

Apache2.2.21 may vary. It depands on apache version.

Second Step:

Find following values in the php.ini file:

and Replace with:

Final Step:
Now restart your wamp server.

That’s it. I hope this is really cool one. Thanks for visiting,. Keep in touch with us for more tutorial.