date 相关问题

日期是对日历系统中表示的特定日期的引用,包括年,月和日。


java日期输出是错误的。为什么?

i'i'am玩Java日期,无法理解这一点:

回答 3 投票 0

如何使用sys_info成员开始从get_info()收到的sys_seconds折断时间 我正在尝试找出给定的日期是否等于DST过渡日期(DST在当天开始或结束)。我的程序如下 #include“ date/tz.h” #include

#include "date/tz.h" #include <chrono> #include <iostream> template <class Duration> bool is_dst(date::zoned_time<Duration> const& zt) { using namespace date; using namespace std; using namespace chrono; auto info = zt.get_info(); std::cout << "TZ Range start: " << info.begin + info.offset << " range end " << info.end + info.offset << std::endl; auto dst_hours = std::chrono::duration_cast<std::chrono::hours>(info.save); auto dst_minutes = std::chrono::duration_cast<std::chrono::minutes>(info.save - dst_hours); return info.save != minutes{0}; } int main(int argc, char *argv[]) { using namespace date; using namespace std; using namespace chrono; std::string tzname = argv[1]; int yy = std::atoi(argv[2]); int mm = std::atoi(argv[3]); int dd = std::atoi(argv[4]); int h = std::atoi(argv[5]); int m = std::atoi(argv[6]); // Construct a local_time type from the broken-down time local_seconds localTime = date::local_days{date::year{yy}/mm/dd} + std::chrono::hours{h} + std::chrono::minutes{m}; auto tz = locate_zone(tzname); auto dst_on_off = is_dst(zoned_time<std::chrono::seconds>{tz, zt, date::choose::latest}); cout << "input time :" << localTime << " latest=" << dst_on_off << '\n'; } 现在我有以下问题,如果我执行以下方式 ./hh_get_utc_dst_offset“澳大利亚/悉尼” 2025 10 05 01 00 TZ范围开始:2025-04-06 02:00:00范围END END 2025-10-05 02:00:00 输入时间:2025-10-05 01:00:00最新=0 。/hh_get_utc_dst_offset“澳大利亚/悉尼” 2025 10 05 03 00 TZ范围开始:2025-10-05 03:00:00范围END END 2026-04-05 03:00:00 输入时间:2025-10-05 03:00:00最新=1,根据sys_info的文档 “开始和结束字段表明,对于关联的time_zone和time_point,偏移量和abbrev在范围内有效[开始,结束)。”这是什么意思? 在DST关闭其印刷电流范围的第一个执行 在第二个执行中,DST在其打印未来范围内 也是我要将info转换为破碎的时间,我该怎么做?我想比较命令行中给出的日期与从info.being和info.end.end.ind. 因此,根据sys_info的文档,“开始和结束字段表示,对于关联的time_zone和time_point,偏移量和abbrev在范围内生效[begin,end,end)。”这是什么意思? 我相信这是问题的关键。 表达式[begin, end)指“半开”范围。 范围开始并包括begin。 但是范围不包括end。 该范围停止了即时。 这意味着end在.offset上无效,因此该表达式: end 没有有效 较少的错误转换为当地时间的方法是: info.end + info.offset 也是我要将info转换为破碎的时间,我该怎么做?我想比较命令行中给出的日期与从info.being和info.end.end.ind. 您可以将序列时间_point分解为UTC字段或本地字段中的字段。 要确定哪个,首先在[begin, end)或auto tz = zt.get_time_zone(); std::cout << "TZ Range start: " << tz->to_local(info.begin) << " range end " << tz->to_local(info.end) << std::endl; 中分别获得序列时间_point。 修理您想要本地字段,并仅显示sys_time: local_timeinfo.begin具有// First convert the `sys_time` to `local_time`: auto local_begin = tz->to_local(info.begin); // local_begin is a datetime // truncate it to just a date auto local_begin_date = floor<days>(local_begin); // Extract the local time of day from the datetime and date auto local_tod = local_begin - local_begin_date; // Convert local_begin_date to a {y, m, d} data structure year_month_day local_ymd{local_begin_date}; // Convert local_tod to a {h, m, s} data structure hh_mm_ss local_hms{local_tod}; ,year_month_day和.year() 这些返回强烈键入的表示.month(),.day()和year。 这些反过来可以分别明确地施放为month,day和int。 unsigned具有强烈键入表示的the tegtersunsigned,hh_mm_ss和.hours()getters。 这些中的每一个都可以通过.minutes()成员函数转换为积分类型。 在每个阶段,从.seconds(),一直到hoursminutes,每种类型都可以像这样流出: seconds

回答 1 投票 0


PL/SQL检查日期有效

如果我在pl/sql中有一个日期格式ddmm,我想对其进行验证。正确的方法是什么? DD是一天,MM是飞蛾。 例如: 0208-是有效的日期 3209-不是有效的...

回答 3 投票 0



找到下一个星期一6:00的Java日期,例如

但是,用户可以指定他们想要的一周的时间。这是有一个长的价值来完成的,从周四0:00以毫秒为单位,它可以抵消一周的时间。我很难缠绕着这个问题,但这是我到目前为止的事情:

回答 4 投票 0



如何仅在几个月内使用Java的Joda API计算差异 我正在编写一个程序,该程序应该仅计算给定日期的2个月并将其返回程序中的几个月。例如,如果我必须计算1 a ...

DateTime start = new DateTime().withDate(2011, 4, 1); DateTime end = new DateTime().withDate(2011, 6, 30); Months mt = Months.monthsBetween(start, end); int monthDiff = mt.getMonths();

回答 7 投票 0


回答 3 投票 0

在php中的数组中将连续日期组合在一起[重复]

我在数组中有以下日期(日期并非总是这些日期) [0] 2012-10-18 [1] 2012-10-19 [2] 2012-10-20 [3] 2012-10-23 [4] 2012-10-24 [5] 2012-10-29 [6] 2012-10-30 我想分组

回答 2 投票 0


在Spark DataFrame

我已经看到(这里:如何将时间戳转换为数据框中的日期格式?)转换数据类型中时间戳的方法,但是至少对我来说,它不起作用。 这是我尝试的: #创建DataFrame

回答 7 投票 0

列“现在”不存在postgresdjango

我有一个Django应用程序,该应用将日期列存储在Postgres中的模型/表中 first_subscribed = models.datefield(auto_now = true),并且效果很好。 但是,如果我启用触发器可以从表/

回答 1 投票 0


在选定的记录中使用一个日期字段,并具有计算的相对日期

我正在寻找的最终结果是要有一个查询,该查询将在表1中找到特定的记录,使用加入Table2中的字段检索一周的一天,使用公式来确定下一个发生的

回答 1 投票 0


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.