Skip to content

Instantly share code, notes, and snippets.

@vasmani
Created February 19, 2013 06:25
Show Gist options
  • Select an option

  • Save vasmani/4983572 to your computer and use it in GitHub Desktop.

Select an option

Save vasmani/4983572 to your computer and use it in GitHub Desktop.
datetime to datetime...
function dates(from, to){
var format = 'YYYY-MM-DD HH:mm',
f = moment(from, format),
t = moment(to, format),
current = '',
result = [];
while(current != to){
current = f.add('m',1).format(format);
result.push(current);
}
console.log(result.join("\n"));
}
dates('2012-12-01 13:00', '2012-12-02 11:00');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment