简体   繁体   中英

how can I get yesterdays date in unix format in javascript?

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!

在您拥有的Date对象上调用.getTime()

"...&min_upload_date=" + (yesterday.getTime() / 1000)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM