ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Query brings in wrong date (https://www.excelbanter.com/excel-programming/430111-query-brings-wrong-date.html)

David

Query brings in wrong date
 
Hi Group,

myurl = "http://finance.google.com/finance/historical?histperiod=daily&q=" _
& sym & "&startdate=" & StartMo & "+" & StartDay & "%2C+" & StartYr &
"&enddate=" _
& StopMo & "+" & StopDay & "%2C+" & StopYr & "&output=csv"

With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

The above query is not bringing in the dates that I expected.
The dates should be between 1/12/2009 and 6/8/2009.
The variables used above a
StartMo = 1
StartDay = 12
StartYr = 2009
StopMo = 6
StopDay = 8
StopYr = 2009

It brings in 6/18/2009 back to 6/20/2008, about a year.

Not sure how to change url to get this to happen.

Thanks,
David


Mishell

Query brings in wrong date
 
Try with a date format of YYYY/MM/DD

Mishell

"David" wrote in message
...
Hi Group,

myurl = "http://finance.google.com/finance/historical?histperiod=daily&q="
_
& sym & "&startdate=" & StartMo & "+" & StartDay & "%2C+" & StartYr &
"&enddate=" _
& StopMo & "+" & StopDay & "%2C+" & StopYr & "&output=csv"

With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

The above query is not bringing in the dates that I expected.
The dates should be between 1/12/2009 and 6/8/2009.
The variables used above a
StartMo = 1
StartDay = 12
StartYr = 2009
StopMo = 6
StopDay = 8
StopYr = 2009

It brings in 6/18/2009 back to 6/20/2008, about a year.

Not sure how to change url to get this to happen.

Thanks,
David




David

Query brings in wrong date
 
Hi,
The date is split into variables as indicated below. The query does pull in
data, it is just the wrong dates, and a similar query works with numbers in a
different file.
Thanks for your suggestion.
David

"Mishell" wrote:

Try with a date format of YYYY/MM/DD

Mishell

"David" wrote in message
...
Hi Group,

myurl = "http://finance.google.com/finance/historical?histperiod=daily&q="
_
& sym & "&startdate=" & StartMo & "+" & StartDay & "%2C+" & StartYr &
"&enddate=" _
& StopMo & "+" & StopDay & "%2C+" & StopYr & "&output=csv"

With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

The above query is not bringing in the dates that I expected.
The dates should be between 1/12/2009 and 6/8/2009.
The variables used above a
StartMo = 1
StartDay = 12
StartYr = 2009
StopMo = 6
StopDay = 8
StopYr = 2009

It brings in 6/18/2009 back to 6/20/2008, about a year.

Not sure how to change url to get this to happen.

Thanks,
David





David

Query brings in wrong date
 
HiMishell,

I do not know if you are interested, but I did find the answer. I had to
format the month of each date "mmm", but I do have to break up the query
still, since it is going in as a variable.

Thanks again for your time and efforts.

:),
David

"Mishell" wrote:

Try with a date format of YYYY/MM/DD

Mishell

"David" wrote in message
...
Hi Group,

myurl = "http://finance.google.com/finance/historical?histperiod=daily&q="
_
& sym & "&startdate=" & StartMo & "+" & StartDay & "%2C+" & StartYr &
"&enddate=" _
& StopMo & "+" & StopDay & "%2C+" & StopYr & "&output=csv"

With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

The above query is not bringing in the dates that I expected.
The dates should be between 1/12/2009 and 6/8/2009.
The variables used above a
StartMo = 1
StartDay = 12
StartYr = 2009
StopMo = 6
StopDay = 8
StopYr = 2009

It brings in 6/18/2009 back to 6/20/2008, about a year.

Not sure how to change url to get this to happen.

Thanks,
David





Mishell

Query brings in wrong date
 
I am glad you found the answer.

Mishell

"David" wrote in message
...
HiMishell,

I do not know if you are interested, but I did find the answer. I had to
format the month of each date "mmm", but I do have to break up the query
still, since it is going in as a variable.

Thanks again for your time and efforts.

:),
David

"Mishell" wrote:

Try with a date format of YYYY/MM/DD

Mishell

"David" wrote in message
...
Hi Group,

myurl =
"http://finance.google.com/finance/historical?histperiod=daily&q="
_
& sym & "&startdate=" & StartMo & "+" & StartDay & "%2C+" &
StartYr &
"&enddate=" _
& StopMo & "+" & StopDay & "%2C+" & StopYr & "&output=csv"

With qt
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

The above query is not bringing in the dates that I expected.
The dates should be between 1/12/2009 and 6/8/2009.
The variables used above a
StartMo = 1
StartDay = 12
StartYr = 2009
StopMo = 6
StopDay = 8
StopYr = 2009

It brings in 6/18/2009 back to 6/20/2008, about a year.

Not sure how to change url to get this to happen.

Thanks,
David








All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com