Skip to content

Instantly share code, notes, and snippets.

@gavinking
Created December 1, 2016 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavinking/6a00f7c56bcd2db586ba543a18ff9ebd to your computer and use it in GitHub Desktop.
Save gavinking/6a00f7c56bcd2db586ba543a18ff9ebd to your computer and use it in GitHub Desktop.
Ceylon Web Runner: Converting JavaScript Date to Ceylon DateTime
import ceylon.time { Instant, DateTime }
shared void run() {
dynamic {
//create a JavaScript Date
dynamic date = Date();
print(date);
//convert it to a Ceylon DateTime
DateTime dt = Instant(date.getTime()).dateTime();
print(dt);
}
}
module web_ide_script "1.0.0" {
// Add module imports here
import ceylon.time "1.3.1";
}
@gavinking
Copy link
Author

Click here to run this code online

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment