views:

45

answers:

1

Hello! I'm self-learning the REST concept and am playing with the Flickr API. One of the parameters that Flickr requires is the min_upload_date, which is formatted in the Unix date format and looks like this in the example...

&min_upload_date=1199145600

I'd like to set the min_upload_date to the day before the current day, but I don't even know where to start with this. I've found the Date() object in javascript and figured out how to set it equal to yesterday's date, but how do I convert it to the format that Flickr needs?

Thanks in advance for all your help!

+1  A: 

call .getTime() on the Date object you have:

"...&min_upload_date=" + (yesterday.getTime() / 1000)
Roatin Marth
`.getTime()` actually returns the number of **milliseconds** since the Unix epoch, not the number of **seconds**.
Jordan Ryan Moore
@Jordan: see the `/ 1000` perhaps?
Roatin Marth
That's what the `/ 1000` is for
Greg
thank you, worked great!
BeachRunnerJoe