Reputation: 4183
I need to convert the DateTime to meet Excel's Requirement for formatting cells: http://weblogs.asp.net/stanleygu/microsoft-office-xml-tip-use-the-correct-format-for-the-datetime-data-type-to-avoid-error
With strftime http://apidock.com/rails/ActiveSupport/TimeWithZone/strftime i can't see the fff part.
How can i convert DateTime.now into this excel compatible format?
yyyy-MM-ddTHH:mm:ss.fff
especially the fraction of the seconds fff.
Upvotes: 1
Views: 1528
Reputation: 3869
If you need get a string in correct format you can use striftime method:
DateTime.now.strftime("%Y-%m-%dT%H:%M:%S.%L")
Upvotes: 4