Created
December 1, 2016 20:53
-
-
Save gavinking/6a00f7c56bcd2db586ba543a18ff9ebd to your computer and use it in GitHub Desktop.
Ceylon Web Runner: Converting JavaScript Date to Ceylon DateTime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module web_ide_script "1.0.0" { | |
// Add module imports here | |
import ceylon.time "1.3.1"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Click here to run this code online