Commit e37edfa5 by Manzar Hussain

add time

parent 0ae0d84d
......@@ -258,8 +258,24 @@
var regularMarketChange = response.price.regularMarketChange.fmt;
var regularMarketChangePercent = response.price.regularMarketChangePercent.fmt;
$('#bse_time_stock').text("IST "+regularMarketChange+" "+regularMarketChangePercent)
let unix_timestamp = response.price.regularMarketTime;
// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds.
var date = new Date(unix_timestamp * 1000);
// Hours part from the timestamp
var hours = date.getHours();
// Minutes part from the timestamp
var minutes = "0" + date.getMinutes();
// Seconds part from the timestamp
var seconds = "0" + date.getSeconds();
// Will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
$('#bse_time_stock').text(formattedTime+" IST "+regularMarketChange+" "+regularMarketChangePercent)
if(regularMarketChangePercent.substring(0,1)=='-')
{
......@@ -287,7 +303,20 @@
$('#nse').text("NSE:"+response.price.regularMarketPrice.fmt);
var regularMarketChange = response.price.regularMarketChange.fmt;
var regularMarketChangePercent = response.price.regularMarketChangePercent.fmt;
$('#nse_time_stock').text("IST "+regularMarketChange+" "+regularMarketChangePercent)
let unix_timestamp = response.price.regularMarketTime;
// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds.
var date = new Date(unix_timestamp * 1000);
// Hours part from the timestamp
var hours = date.getHours();
// Minutes part from the timestamp
var minutes = "0" + date.getMinutes();
// Seconds part from the timestamp
var seconds = "0" + date.getSeconds();
// Will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
$('#nse_time_stock').text(formattedTime+" IST "+regularMarketChange+" "+regularMarketChangePercent)
if(regularMarketChangePercent.substring(0,1)=='-')
{
$('#nse').parent('li').addClass('down');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment