• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/time/time_to_iso8601.h"
6 
7 #include "base/strings/stringprintf.h"
8 #include "base/time/time.h"
9 
10 namespace base {
11 
TimeToISO8601(const Time & t)12 std::string TimeToISO8601(const Time& t) {
13   Time::Exploded exploded;
14   t.UTCExplode(&exploded);
15   return StringPrintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", exploded.year,
16                       exploded.month, exploded.day_of_month, exploded.hour,
17                       exploded.minute, exploded.second, exploded.millisecond);
18 }
19 
20 }  // namespace base
21