jquery - Javascript : string to date -


this question has answer here:

i using jquerys datepicker retrieve dates. getting date in following string format fri may 01 10:24:33 bst 2015.

i know can convert strings in javascript

new date('2011-04-11') 

or

new date('2011-04-11t11:51:00') 

does know how can can convert fri may 01 10:24:33 bst 2015 format date in javascript?

you looking (your date in bst format): bst date javascript date

var timezone_map = {     'bst': 'gmt+0100' };  function re_order(str) {     var re = /^(\w+) (\w+) (\d\d) (\d\d:\d\d:\d\d) (\w+) (\d\d\d\d)$/;     return str.replace(re, function ($0, day, month, date, time, zone, year) {         return day + ' ' + month + ' ' + date + ' ' + year + ' ' + time + ' ' + (timezone_map[zone] || zone);     }); }  new date(re_order('tue apr 28 16:15:22 bst 2015')); // tue apr 28 2015 16:15:22 gmt+0100 (gmt daylight time) 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -