用于转换日期时间格式和货币的通用工具或库。 [英] Common Tool or Library for converting Date-Time Formats and currency.
本文介绍了用于转换日期时间格式和货币的通用工具或库。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个支持从一种日期时间格式转换为另一种格式的库。
我们应该能够提供日期时间字符串和所需格式作为输入字符串。
类似的库应该支持货币转换。
如果有任何此类库可用,请提供建议和帮助。
解决方案
查看 ICU [ ^ ]。
对于日期时间,您可能还会考虑< a href =http://www.boost.org/doc/libs/1_39_0/doc/html/date_time.html> Boost.Date_Time [ ^ ]。
C ++包括对两种类型的时间操作:
计时库,灵活的类型集合,可以跟踪不同程度的预测ision(例如std :: chrono :: time_point)。
C风格的日期和时间库(例如std :: timechrono库
计时库定义了三种主要类型(持续时间,时钟和时间点)以及实用功能和常见的typedef。
持续时间
持续时间由一段时间组成,定义为某个时间单位的某些滴答数。例如,42秒可以由一个由1秒时间单位的42个滴答组成的持续时间表示。
在标题中定义< chrono>
在命名空间中定义std :: chrono
持续时间
(C ++ 11)
a时间间隔
(课程模板)
时钟
时钟由起点(或纪元)和刻度率组成。例如,时钟可能有一个时代1970年1月1日,每秒钟滴答.C ++定义了三种时钟类型:
定义在标题< chrono>
在命名空间std :: chrono中定义
system_clock
(C ++ 11)
来自全系统实时时钟的挂钟时间
(等级)
steady_clock
(C ++ 11)
永远无法调整的单调时钟
(上课)
high_resolution_clock
(C ++ 11)
时间最短的时钟可用
(上课)
时间点
时间点是自特定时钟的纪元以来经过的持续时间。
在标题< chrono>中定义。
在命名空间中定义std :: chrono
time_point
(C ++ 11)
a时点
(课堂模板)
C风格的日期和时间库
还提供了C风格的日期和时间函数,例如std :: time_t,std :: difftime和CLOCKS_PER_SEC
Hi,
I am looking for a Library which supports conversion from One Date-Time Format to another format.
We should be able to provide Date-time string and Desired Format as an input string.
Similarly library should support Currency conversion.
If any such library is available please suggest and help.
解决方案
Have a look at ICU[^].
For date-time you might also consider Boost.Date_Time[^].
C++ includes support for two types of time manipulation:
The chrono library, a flexible collection of types that track time with varying degrees of precision (e.g. std::chrono::time_point).
C-style date and time library (e.g. std::timechrono library
The chrono library defines three main types (durations, clocks, and time points) as well as utility functions and common typedefs.
Duration
A duration consists of a span of time, defined as some number of ticks of some time unit. For example, "42 seconds" could be represented by a duration consisting of 42 ticks of a 1-second time unit.
Defined in header <chrono>
Defined in namespace std::chrono
duration
(C++11)
a time interval
(class template)
Clocks
A clock consists of a starting point (or epoch) and a tick rate. For example, a clock may have an epoch of January 1, 1970 and tick every second. C++ defines three clock types:
Defined in header <chrono>
Defined in namespace std::chrono
system_clock
(C++11)
wall clock time from the system-wide realtime clock
(class)
steady_clock
(C++11)
monotonic clock that will never be adjusted
(class)
high_resolution_clock
(C++11)
the clock with the shortest tick period available
(class)
Time point
A time point is a duration of time that has passed since the epoch of specific clock.
Defined in header <chrono>
Defined in namespace std::chrono
time_point
(C++11)
a point in time
(class template)
C-style date and time library
Also provided are the C-style date and time functions, such as std::time_t, std::difftime, and CLOCKS_PER_SEC.
这篇关于用于转换日期时间格式和货币的通用工具或库。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文