简体   繁体   English

在 Excel 上将日期格式转换为文本格式失败

[英]Failed to Convert Date Format to Text Format on Excel

Can some one help me?有人能帮我吗? I've tried convert date format on excel using this formula我尝试使用此公式在 excel 上转换日期格式

=TEXT(D1,"yyyy-dd-mmm")

but it doesn't work and shows me an error.但它不起作用并显示错误。

I want to format it because date field gave me wrong value when I want send it to database using this formula我想格式化它,因为当我想使用这个公式将它发送到数据库时,日期字段给了我错误的值

="INSERT INTO table_name (field1,field2) VALUES ('"&A1&"', '"&D1&"')".

在此处输入图像描述

You don't need to format the date in a separate cell, you can do it in the one formula.您不需要在单独的单元格中格式化日期,您可以在一个公式中完成。 You also want to use yyyy-mm-dd a the the format for SQL:您还想使用 yyyy-mm-dd 格式为 SQL:

="INSERT INTO table_name (field1,field2) VALUES ('"&A1&"', '"&TEXT(D12,"yyyy-mm-dd")&"')"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM