writing date on an excel sheet

8 views (last 30 days)
S
S on 24 Aug 2011
Edited: Prieni on 18 Aug 2017
Hi folk,
Got a question about writing date on an excel sheet. I am using the following codes:
DATE=datestr(now);
xlswrite('test.xls', DATE, 'A1')
The problem is that it separates each number and letter and put them in separate cells. I want the whole date in one cell like 'A1' but it appears from 'A1' to 'T1'
I appreciate your help. Thank you.
S:-)
  1 Comment
Prieni
Prieni on 18 Aug 2017
Edited: Prieni on 18 Aug 2017
Just came across the problem to export date/time to an Excel sheet. If you do this:
DATE = now - datenum(1899,12,30,0,0,0);
xlswrite('test.xls',DATE)
you get a number in your Excel sheet that, if you change formatting to date, shows the current date. It also includes the current time which you can see when you select that date.

Sign in to comment.

Accepted Answer

Oleg Komarov
Oleg Komarov on 24 Aug 2011
xlswrite('test.xls', {datestr(now)})
  2 Comments
S
S on 24 Aug 2011
Thank you very much Oleg:)
Rageeni sah
Rageeni sah on 10 Jun 2014
Hello, Is this code work for you??

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!