2012-05-27

Blogger ブログ移行用、MovableType 形式のエクスポートデータの日付を変換するツール

最近投稿のタイトルが長くなってきている気がするのだけれど、まあ、表題の通り。


このツールで自動的にしてくれること:
  • 日本標準時(JST)をグリニッジ標準時(GMT)に変換。 (例: 5/5 08:34 → 5/4 23:34)
  • 24 時間制の時刻を 12 時間表記に。 (例: 23:34 → 11:34 PM)
  • 0 時台は 12 時台へ書き換え(Blogger の仕様)。 (例: 0:12 AM → 12:12 AM)

他のブログサービスのブログデータを Blogger へ移行するときに使用する、エクスポートファイル変換ツール MovableType2Blogger へデータを送る前に、こちらで日時変換を行っておくのがいいかと。






ちなみに、けっこうどうでもいいことだけれど、このツールのコードはこちら。
<script type="text/javascript">
<!--
function getGMTDate(s) {
  var d = new Date(s);
  var h = d.getUTCHours();
  var a;
  if (h > 11) {
    a = "PM";
    h -= 12;    
  } else {
    a = "AM";
  }
  if (h == 0) {
    h = 12;
  }
  return getDecimalNumber(d.getUTCMonth() + 1) + "/" + getDecimalNumber(d.getUTCDate()) + "/" + d.getUTCFullYear() + " " + getDecimalNumber(h) + ":" + getDecimalNumber(d.getUTCMinutes()) + ":" + getDecimalNumber(d.getUTCSeconds()) + " " + a;
}
function getDecimalNumber(n) {
  if (n >= 0 && n < 10) {
    return "0" + n;
  } else {
    return "" + n;
  }
}
function changeDate() {
  var raw = document.getElementById("datechangerin").value;
  var rslt = raw.replace(/^DATE: (.*)$/gm, function(a, b) {return "DATE: " + getGMTDate(b);});
  document.getElementById("datechangerout").value = rslt;
}
function selectResult() {
  document.getElementById('datechangerout').select();
}
//-->
</script>
<form action="" onsubmit="changeDate();return false;">
  <textarea id="datechangerin" name="" rows="10" cols="30"></textarea>
  <input type="submit" value="変換" />
  <textarea id="datechangerout" name="" rows="10" cols="30" readonly="readonly"></textarea>
  <input type="button" onclick="selectResult();" value="全選択" />
</form>
何かの参考になれば幸い。

14 comments:

  1. 日付が反映されず困っていたところ本当に助かりました!

    ReplyDelete
  2. 無事移転ができました。ありがとうございます。

    ReplyDelete
  3. こちらんp記事を参考に、すごく簡単に引越しができました!ありがとうございました。

    ReplyDelete
  4. もし手作業だったら気が遠くなるような量の日付が、おかげさまで一発変換できました!
    助かりました、ありがとうございます!

    ReplyDelete
  5. こちらの記事のおかげで、引っ越し作業が簡単にすみました。本当にありがとうございました!

    ReplyDelete
  6. 過去日付が反映されずに困っていたので、助かりました

    あと変換後、変換のボタンの隣にクリアがあるともっといいと思います
    可能でしょうか?

    ReplyDelete
  7. こちらのツールのお陰で、ブログの引越が大分ラクにできました。
    ありがとうございました。

    ReplyDelete
  8. 大変助かりました。ありがとうございました。

    ReplyDelete
  9. Allassignmenthelp is the favorite choice of students all over the world for getting online assignment help from experts. Some of the possible causes they choose Australian assignment help service from us is on-time delivery and 24*7 hours availability. Also, they prefer us as the student assignment online website to get reputable assignment help, because they found the best assignment writing experts team which can accomplish their need of Melbourne assignment help like services.

    ReplyDelete
  10. Chinese Translation Services Singapore have made a squad of expert linguists, local language Translators, quality assurance managers, proofreaders, & editors competent of providing better translation services in different languages

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. You had me engaged by reading and you know what? I want to read more about that. That's what's used as an amusing post. At My Assignment Help Au, We Offer Pocket-Friendly Services And Write Tailored Assignments. Students Trust Our Assignment Help in Australia. To Get Authentic Assignments Within Deadlines, Hire Us Today!

    ReplyDelete
  13. Students come to us to do my essay online in Australia. If we talk about the reflective essay, it is usually required in a portfolio for admission in higher education. Its introduction gives a general overview of the goals pursued by the student and to what extent the goals have been delivered.We at EssayAssignmentHelp.com.au strive to deliver economical college essay writing while not compromising on the quality of essays and assignments. If you want to check our authenticity, you can check a few essay writing service reviews where many of our satisfied reviewers have described our services as satisfactory. Know more about essay help online now.

    ReplyDelete
  14. At MyAssignmenthelp.co.uk, we have some of the choicest and native writers in the study help team who are well-versed with the norms of prestigious universities like Cambridge, Oxford, King’s College, and University of Edinburgh etc. We do not charge more. If you have been looking for an online custom writing service agency that takes care of your assignment needs but will not cost you more, we are the only place in the UK to visit for it.

    ReplyDelete