-1

how to change the format of date that getting from databaseenter image description here getting date from database showing some error. please check the image

Shaggy
  • 6,696
  • 2
  • 25
  • 45
kannan D.S
  • 1,107
  • 3
  • 17
  • 44

2 Answers2

1

try this

var date = new Date(parseInt(yourDate.substr(6)));

to format your date use the following code

 var parsedDate= new Date(date); 
var formattedDate =parsedDate.getDate()+"-"+parsedDate.getMonth()+"-"+parsedDate..getFullYear();
Optimus
  • 2,200
  • 8
  • 37
  • 71
0

You could try this, assuming you can manipulate the 'date' you are getting from the database:

d = yourdate();
new_d = d.toUTCString();

There are also .toLocaleTimeString() (for times i.e., 11:11:12 am) and .toDateTimeString() (for days i.e., 11/11/2011)

Kaushik Maheta
  • 1,741
  • 1
  • 18
  • 27
rrd
  • 5,789
  • 3
  • 28
  • 36