javascript count backwards 23 week days from current day for stock tracking [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am working on an application to get historical stock data from yahoo finance csv api. I am having trouble creating a script that will get the current day and count back 23 weekdays (not counting weekends or holidays). The idea is that it will plug the two dates in at yahoo, get the historical data and then create a moving average. I am unsure how to do this using the date function though.

You could use the Moment.js library, if you are able to provide that to your page. You could use it to do something like this:
var today = moment();
var pastDate = today.subtract('days', 23);
// then do something with those two variables...
if you need them in a certain format before you pass them along, just call .format on them
getHistoricalData(today.format('YYYYMMDD'), pastDate.format('YYYYMMDD'));

Related

display time and date in GMT or UTC [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am trying to display GMT/UTC time with current date LIVE
i can display current time with it will be fixed until did refresh for the page
what i need to do display the time and date in UTC/GMT in my page as PHP or java code
thank you
If you want to convert your current time to another timezone lets say GMT or UTC then you can follow the following steps for javascript:
You can use moment-timezone lib.
const moment = require('moment-timezone')
const now = moment().format()
moment.tz(now, 'UTC').format()
moment.tz(now, 'GMT').format()

How to convert excel date to timestamp [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I got array of dates from excel file and they look like strange fractional numbers: 42425.4166550926, 42419.3326041667, 42411.5419097222, etc. How to convert them to unix timestamp or javascript date?
To convert date to timestamp, a formula can work it out.
Select a blank cell and type this formula =(A1-DATE(1970,1,1))*86400 into it and press Enter key, if you need, you can apply a range with this formula by dragging the autofill handle. Now a range of date cells have been converted to Unix timestamps.
Source
Another source...

Time lapse web interface [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hello and thanks in advance for looking at my problem. I'm trying to create a web interface for a time lapse project I'm doing right now, but I don't know exactly where to start with this.
What I have
A website, obviously;
A lot of pictures, made every 15 minutes;
Stored in folders (/mm-yy), saved as dd-mm-yy_hhmm.jpg.
What I'm looking for
I want to be able to select a date with a datepicker, which returns all the pictures taken on that particular day so I can show only those pictures on the site.
I've been searching around but I have troubles finding out what the best solution is and where to start. I don't have a lot of experience with JavaScript. I thought maybe create a JSON-file with all the images (regenerated every 15 minutes) and use that in some way with a datepicker?
Any ideas, tips and/or tricks?
There are numerous ways to approach this but since you tagged php my first impulse would be something akin to:
Walk the directory tree to find all represented months
For a given month build your date list using regex - this will let you pull out the date matches you need
Create your date picker using one of the many, many javascript options
IIWM I wouldn't mess about with a separate file the gets regenerated. Do your population when the page opens.

Generating random id using current date [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm doing a bank oriented project. I have to generate Account Number using current date.
Example:
account no-20150409001.
'2015'-Year,
'04'-Month,
'09'-Date,
'001'-represents the number of the new member opening the account on that particular date
This number should change in every branch to avoid same account number.
How to do so?
and this is my code
http://jsfiddle.net/Jegannath/z9na41o5/#&togetherjs=ynHxlyDeO1
If this is really a bank related project, do not rely on client side JavaScript for something as critical as the account number generation.
Is there a reason for the "random" number requirement? If not, stick with a sequence, it is a lot easier to ensure uniqueness.
On the server side, using a branch prefix as suggested by #kuldeep.kamboj should cover collision.
You can use something like yyyyMMddBBnnnn where yyyy = year, MM = month, dd = day, BB = branch number, and nnnn as a sequence that resets per day.
Not sure,this is correct advise,
Go with branch code prefix and timestamp in suffix, this might be developer friend also, because in future after 30 year easily you can tell his account created date with the help of timestamp.
As well timestamps is kind of random number.
advisable is server side code.

I want to create a script which tells me when a post is posted [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create a script in php, javascript or jquery which tells me when a post is posted like Facebook in facebook when we post a status it tells us posting time like 5 minute ago or so on. I have completed all other work.
Create a coloumn to the table where you save the post details as posted_at and have DATETIME as its data type,
Use $CurrentTime = date("Y-m-d H:i:s" ); and insert while you create the post i.e., insert
So while retrieving the data just find the difference between the posted time and current time by
$PostedTime = strtotime($FetchedData->posted_at) - strtotime(date("Y-m-d H:i:s" ));
Then you shall convert the difference time as per your wish.
You have to create function that will get one parameter "posted date" and it will calculate difference from today. it will generate string and return like "2 days ago/5 min ago" or date. it is depend on you.

Categories