简体   繁体   中英

ENTER DATE WITH TIME STAMP IN MS-EXCEL

I am using CONCATENATE funciton to group data in a cell in which i have to include date and timestamp. i need to run some batches of data in my database as part of my daily routine. i need the date and timestamp at most importantly as that will help in minimizing my work load.

DATA CELL A3: 2012-07-31 18:00:00 CELL B3: (521976, 521977, 521978, 521979) FORMULA: =CONCATENATE("update tbl_content_master set start_date='",A3,"' where content_id in ",B3,";") RESULT: update tbl_content_master set start_date='41121.75' where content_id in (521976, 521977, 521978, 521979);

ISSUE FROM FORMULA start_date='",A3,"' ie 2012-07-31 18:00:00 (date with time stamp) FROM RESULT start_date='41121.75' ie 41121.75 (decimal format)

PRESENT RESULT: update tbl_content_master set start_date='41121.75' where content_id in (521976, 521977, 521978, 521979);

REQUIRED RESULT: update tbl_content_master set start_date='2012-07-31 18:00:00' where content_id in (521976, 521977, 521978, 521979);

使用TEXT函数:TEXT( 带日期的单元格 ,“ 格式字符串 ”)

=CONCATENATE("update tbl_content_master set start_date='",TEXT(A3,"YYYY-mm-dd hh:mm:ss"),"' where content_id in ",B3,";")

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.

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