- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The following problem would take a single line of C++ code yet in fortran it seems nearly impossible to achive without extensive additional coding.
I want to output date and time into a string. I have 7 double precision variables holding the data:
fYear, fMonth, fDay, fHour, fMonth, fMin, fSec, fAbs
And I want do do the simple task of writing those to a time string like this:
"00h 00m 00.0s 00/00/00 (000000.00)"
(The order of the entries is: fHour, fMin, fSec, fDay, fMonth, fYear, fAbs)
Whatever I try either do I get "**" entries, leading zeros are not printed or commas appear where I dont want them.
Could anyone suggest me a format line that will do what I want? I need the leading zeros and i don't want comas to appear in the entries for hours minutes.... Even if they are technically floating point values.
The following problem would take a single line of C++ code yet in fortran it seems nearly impossible to achive without extensive additional coding.
I want to output date and time into a string. I have 7 double precision variables holding the data:
fYear, fMonth, fDay, fHour, fMonth, fMin, fSec, fAbs
And I want do do the simple task of writing those to a time string like this:
"00h 00m 00.0s 00/00/00 (000000.00)"
(The order of the entries is: fHour, fMin, fSec, fDay, fMonth, fYear, fAbs)
Whatever I try either do I get "**" entries, leading zeros are not printed or commas appear where I dont want them.
Could anyone suggest me a format line that will do what I want? I need the leading zeros and i don't want comas to appear in the entries for hours minutes.... Even if they are technically floating point values.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I2.2,'h',1X,I2.2,'m',1X,F04.2,1X,2(I2.2,'/'),I2.2,'(',F09.2,')'
should come close
You won't get any commas unless you put them in yourself although they may appear to be there if you use something like Excel to read the output - that would be down to the locale settings in Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply
Unfortunately it does not seem to work.
I need a way to output floating point values either with leading spaces or with leading zeros. I guess if there is a way to align the values on the right side of its output field it should work but I'm not sure if that is possible.
I'd like to use this for putting a time stamp on each frame in an animated sequence. In order for the timestemp to remain readable I need to make sure that the date fields keep their size.
Unfortunately it does not seem to work.
I need a way to output floating point values either with leading spaces or with leading zeros. I guess if there is a way to align the values on the right side of its output field it should work but I'm not sure if that is possible.
I'd like to use this for putting a time stamp on each frame in an animated sequence. In order for the timestemp to remain readable I need to make sure that the date fields keep their size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you looked at portability routines (that were available in CVF) such as
CLOCK, CTIME, DATE, DATE_AND_TIME etc.?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page