I'm trying to prepare a query string from an excel spreadsheet where I have a problem with excel date.
Desired Result
Insert into table_name values("2013:09:10 10:00:00");
Data
excel spreadsheet cell A1 = "2013/09/10 10:00 AM"
Trying
within Cell B1 I am trying to put ="Insert into table values('"& A1 &"');"
Problem
Instead of giving desired result it gives me something like
Insert into table_name values("45265.545486745456");
Please help,
Thanks
Excel stores dates as a serial string that counts the days from January 1, 1900. For example, Excel sees 10:00AM on September 10, 2013 as 41527.41666...
To get the text output formatted like a date, you can use the TEXT function. In your example, you want the function call to look like this:
=TEXT(A1,"yyyy:mm:dd hh:mm:ss")
To fix your cell B1, you might write it like this:
="Insert into table values('"&TEXT(A1,"yyyy:mm:dd hh:mm:ss")&"');"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.