问题标签 [string-to-datetime]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 使用稀有日期格式将 Pandas 列转换为 DateTime
我的数据框中有一列遵循此日期格式:
2016 年 5 月 17 日
我尝试遵循此参考:http ://strftime.org/ 和 pandas.to_datetime 参考:http ://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.to_datetime.html
我的代码如下:
df1 =df1.apply(pandas.to_datetime, errors='ignore', format='%d %b%Y')
我也试过了:format='%d/%b%Y'
format='%d /%b%Y'
还是不行。日期列类型仍然是对象。有任何想法吗?提前致谢
tsql - 从 SQL Server 2014 中的 Year_Month_Snap 字符串计算一天中的最后一天和小时
我正在学习 SQL Server 并被困在这个转换问题上。任何帮助是极大的赞赏。
我在 SQL Server 2014 中有一个表,Year_Month_Snap
其中有一列包含数据类型中的nvarchar
数据。
我需要从 2016 年 1 月开始连续 35 个月获取月末的最后一天和最后一小时。
我看到有很多建议将固定日期捕捉到 YYYY-MM 部分以使其成为 YYYY-MM-DD 部分并将其转换为日期和日期时间,但由于每个月的最后一个日期每个月都不同(可能是30 天月或 31 天或 28/29 天二月月)所以我需要从列nvarchar
中的 YYYY-MM 数据类型计算给定月份的最后日期和小时Year_Month_Snap
。
当我尝试将其转换为日期/日期时间时,它会引发以下错误:
消息 241,级别 16,状态 1,第 25 行
从字符串转换日期和/或时间时转换失败。
Year_Month_Snap 列
任何帮助是极大的赞赏!!
sql - Informix 中的日期格式
date
是否可以在以下格式中打印Informix DB
,
May 19 1993 12:00AM
?
考虑下面的例子,
如果我拍摄以下查询,
它显示为,
但我希望输出打印为,
python - 对于 1970 年之前的日期,Python 将日期格式从 dd/mm/yy 更改为 dd/mm/yyyy
我有一个 python pandas 数据框,它的日期列如下:
我想将此对象数据类型转换为日期格式,如下所示:04/06/1953...
我尝试转换为 datetime 数据类型,如下所示:
但输出是这样的:
如何将 1953、1950 等作为年份而不是 2053、2050?
python - Pandas, Handling "Out of bounds timestamp..."
I have a df with certain features as object types which I want to convert to datetypes. When I attempt to convert using pd.to_datetime, some of these features return an "Out of bounds timestamp" error message. To address this, I add "errors= coerce" argument, then seek to drop all NAs which result. For example:
Yet, this doesn't seem to convert the features to 'datetime:' ("maturity_date" is one of the date_features I am trying to convert to datetime).
Furthermore, if I again try to convert maturity_date using pd.to_datetime without "coerce" I get the "Out of bounds" timestamp.
I hope I have described this problem thoroughly.
Any thoughts?
mongodb - 在 Talend 中将字符串转换为 ISO 日期格式
python - 使用 Pandas 格式化日期
我有一个关于在我的数据框中的列中格式化日期的问题。我有点困惑为什么它没有格式化,因为我按照如何使用该pd.to_datetime
方法的说明进行操作。
1230768318
任何人都可以向我提供有关如何使用 Pandas格式化日期(例如“”)的任何见解吗?
非常感谢。
sql-server - 如何从批量插入中仅格式化年和月
我有来自excel的数据,只有年份和月份,例如 2012-01
01 是一月。
对于我的脚本:
我知道这会失败,因为 SQL 无法识别数据的日期格式。
我正在考虑将其作为字符串输入?但这仍然不能解决在 SQL 中将其存储为年月日期的问题。
我是否必须将数据批量插入为 varchar?然后将数据类型转换为日期,每个 [year-month] 在一天的末尾都有 01,例如 2012-01-01,然后切断日期并将年月放在单独的列中?
我在该解决方案中看到的唯一一件事是,一旦我将年月与日分开,新的 [年-月] 日期就不会存储为日期格式?
我想第一步是将数据从excel导入sql,然后将字符串'yyyy-mm'转换为日期格式'yyyy-mm-dd',但我不知道该怎么做?
laravel - 如何在laravel中将输入字符串转换为strtotime
我正在使用 jQuery 日历以如下形式输入日期
我从表单中获取 09-03-2018形式的值。
模型代码,我尝试使用 mutator 对其进行转换,但无法对代码进行建模
控制器代码
迁移代码
我想将其转换为 unix_timestamp 任何帮助将不胜感激
pandas - 办理到期日为 31-12-9999 12:00:00 AM 的永续债
我在数据框中有许多记录,其中到期日期列是 31-12-9999 12:00:00 AM,因为债券永远不会到期。这自然会引发错误:
我看到最大日期是:
我只是想澄清清除 datframe 中所有日期列并修复我的错误的最佳方法是什么?我的代码模仿了文档:
输出: