-1

I am fetching and displaying date from sql server database using Jquery now the problem is that this is what I am getting in my HTML

2013-05-30T10:05:00+05:30

I would like it to be something like 2013-05-30 10:05:00 or just 10:05:00

NO PLUG-IN PLZ

SamuraiJack
  • 5,131
  • 15
  • 89
  • 195
  • Have you seen this: http://stackoverflow.com/questions/5250244/jquery-date-formatting ? – Andre Jun 24 '13 at 07:38

3 Answers3

1

well you can process the outcome in javascript

such that

var s='2013-05-30T10:05:00+05:30';
var time_vl=s.split('T')[1].split('+')[0];

that will give you your output

Ali
  • 595
  • 4
  • 13
  • 42
  • Can you also explain it a bit like what is [1] and [0] for? – SamuraiJack Jun 24 '13 at 08:14
  • 1
    well split actually splits a string where ever it finds its argument in your case s.split('T') will return an array with two items in it [0] will be 2013-05-30 and [1] will be 10:05:00+05:30 , here we took [1] and splited it again by calling s.split('T')[1].split('+') smilarly here we will have two items [0] will be 10:05:00 , and [1] will be 05:30 – Ali Jun 24 '13 at 08:19
0

you should format the DateTime string in your C# code before passing the results to the client side.

ojlovecd
  • 4,812
  • 1
  • 20
  • 22
-1

You can add JQuery UI Plugin in your page :

$("#DateField").val($.datepicker.formatDate('dd M yy', new Date()));
Adrien.C
  • 209
  • 1
  • 3