開発環境
- OS X Lion - Apple(OS)
- Dart SDK (開発環境)
- Dart (プログラミング言語)
『初めてのプログラミング 第2版』(Chris Pine 著、長尾 高弘 訳、オライリー・ジャパン、2010年、ISBN978-4-87311-469-9)の12章(新しいクラスのオブジェクト), 12.1(Timeクラス)、12.2(練習問題)、10億秒をDartで解いてみる。
その他参考書籍
- What is Dart? [Kindle版] (O'Reilly Media) Kathy Walrath Seth Ladd (著) このブログでの感想
10億秒
コード
sample.dart
import 'dart:math' as math; void main(){ var birth = new DateTime(2000, 1, 2, 3, 4, 5); var future = new DateTime.fromMillisecondsSinceEpoch( birth.millisecondsSinceEpoch + math.pow(10, 9) * 1000); print('誕生日: ${birth}'); print('10億秒後: ${future}'); }
入出力結果
誕生日: 2000-01-02 03:04:05.000 10億秒後: 2031-09-10 04:50:45.000
0 コメント:
コメントを投稿