Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to convert date/time values in a CSV Output File

Please note the following output data to a CSV file from EnergyPlus.

Date/Time,Environment:Site Outdoor Air Drybulb Temperature C
07/07 01:00:00,18.416666666666669
...etc.
...etc.
...etc.
07/07 24:00:00,18.0

Note that the last hour on 07/07 is 24:00:00. I was writing a custom interface to these CSV files and cannot convert the string "07/07 24:00:00" to a real date time. I am using C# in Visual Studio. According to Microsoft the hour has to be a number between 00 and 23. Any advice here or do I just need to subtract 1 from all the times? Seems like hours should come out from EnergyPlus as 00 to 23? Or maybe an option to do such? Thanks.

From Microsoft:

The "HH" custom format specifier

The "HH" custom format specifier (plus any number of additional "H" specifiers) represents the hour as a number from 00 through 23; that is, the hour is represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted with a leading zero.

How to convert date/time values in a CSV Output File

Please note the following output data to a CSV file from EnergyPlus.

Date/Time,Environment:Site Outdoor Air Drybulb Temperature C
07/07 01:00:00,18.416666666666669
...etc.
...etc.
...etc.
07/07 24:00:00,18.0

Note that the last hour on 07/07 is 24:00:00. I was writing a custom interface to these CSV files and cannot convert the string "07/07 24:00:00" to a real date time. I am using C# in Visual Studio. According to Microsoft the hour has to be a number between 00 and 23. Any advice here or do I just need to subtract 1 from all the times? Seems like hours should come out from EnergyPlus as 00 to 23? Or maybe an option to do such? Thanks.

From Microsoft:

The "HH" custom format specifier

The "HH" custom format specifier (plus any number of additional "H" specifiers) represents the hour as a number from 00 through 23; that is, the hour is represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted with a leading zero.