Show current date using Javascript in web browser(Client side date in web browser)

For client side scripting,

Go through following lines to product date in DD/MM/YYYY format:

var objToday = new Date();
var dd = objToday.getDate();
var mm = objToday.getMonth() + 1;  //January is 0
var yyyy = objToday.getFullYear();

if (dd < 10) { dd = ‘0’ + dd }
if (mm < 10) { mm = ‘0’ + mm }

var strToday = dd + ‘/’ + mm + ‘/’ + yyyy;

alert(strToday);       // will show like ’17/07/2013′

Advertisements

2 thoughts on “Show current date using Javascript in web browser(Client side date in web browser)

  1. Pingback: Display Image in html as Binary Data with Base64 encoding | borania siddharth - web developer,rajkot, gujarat, india

  2. Pingback: Output parameter in stored procedure with ExecuteReader method | borania siddharth - web developer,rajkot, gujarat, india

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s