The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 convert seconds to date/time

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ysis Posted - 05/24/2011 : 05:24:12 AM
Origin Ver. and Service Release: 8.5.1
Operating System: Windows XP

Hi,

I have (simple, I guess) problem, but can't solve it, because I'm quite new to Origin.

I have a column with time values in seconds (starting from a certain time) with around 60k rows. So for example I started the data acquisition at 17:10 and acquired data over night, taking a datapoint every second. Then the value in the time column goes from 0 to 60000 or so, counting the seconds from 17:10.
Now I want to convert/display these seconds as a time in hh:mm:ss format (probably also including the day, because it's overnight) somehow to make understanding graphs easier.

I converted the times with the time() function to the absolute time, which Origin uses internally, but I can't manage to just display this as something human-readable.

Hope you have some suggestions. Thanks and cheers,
Cornelius
5   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 05/25/2011 : 10:56:26 AM
Hi Cornelius,

I think all what you write above are correct. Origin uses double precision number (double(8)) internally, though when the value is entered or displayed, the "Display" format (in Column Properties dialog shown by double-clicking the column header) is applied. As Greg wrote, when the entered "string" in the cell is not complete, Origin tried to interpret reasonably as its best (say, e.g. today's date).
You can get or see the internal date value by changing the column format to "Numeric", or copy-and-paste to the numeric column.
Does it make sense?

--Hideo Fujii
OriginLab

P.S. I found a good article:
http://www.originlab.com/www/support/resultstech.aspx?ID=295&language=English&Version=7.5
ysis Posted - 05/24/2011 : 2:46:50 PM
Ok, I think I start to understand how this works.

It's just confusing to me, that there is this discrepancy between the following three things:
a) data you enter
b) data you (let) calculate with the "Set column values ..." tool
c) displayed data

If I understand you correctly, when I have the format set to "date" in the column properties and enter something like "12/30/11" it's interpreted as 30th December 2011 and internally converted to the Julian value. Then one can change the date format for example so as to display "111230 00:00", but internally it's still the same, so any calculation made in the "Set column values ..." tool is totally independent of the column format and only operates on the internal values, correct?
If so it would be nice to be able to display/modify these internal values to get a better feeling what really happens behind the scenes. I would have not been able to come up with the solution Hideo provided because I had no clue what the internal format was and the data displayed didn't give a hint, neither.
greg Posted - 05/24/2011 : 12:09:01 PM
First : While Origin uses the modified Astronomical Julian values for its internal date storage, we only display dates beginning with year 100. Anything earlier just displays as missing values.

Second : While Origin can handle incomplete information when entering date values in a cell, we certainly do NOT support entering 'days' or day fractions. Typically we allow partial entry under the assumption that you are using Windows Short date format, but you are using a custom format, so all bets are off unless you explicitly use that full format (time part is optional) as entry, like :
110524 12:34:56
or
100827

For Windows Short format (typically MM/dd/yy on western systems) you can enter 7 and Origin assumes July (7th month) but today's day and year. I could also try 7/31 and Origin assumes July 31 for the current year.

ysis Posted - 05/24/2011 : 11:40:27 AM
Hi Hideo,

thanks for the swift reply. Your solution works well!
I just had to change the x-axis's tick label type from "Date" to "Time" to just get the time when I plot the data as a graph, but this works well with no issues at midnight.

Yet, I still don't understand why your solution works. "(col(A)/(24*60*60))" is the time in (decimal) days, so 1.5 means 1 day and 12 hours, correct? Then date() just returns the number of days since the start of the julian calendar so you can add the "relative" time from the first term.
But I did some testing and just set the format of a new column to "yyMMdd HH:mm:ss" and manually entered "1" for example. This returns "110124 00:00:00" and when I enter "1.5" it displays "110105 00:00:00". I had expected to get the first day in the julian calendar with "1" and half a day later with "1.5". Could you please clarify this?

Thanks,
Cornelius
Hideo Fujii Posted - 05/24/2011 : 10:41:59 AM
Hi Cornelius,

Can you try the following steps (assuming your time-second data is in col(A))?

1) Make a new column, and make the column as Date with a date format such as "yyMMdd HH:mm:ss".
2) Perform the Set Column Values tool with the formula like:
    (col(A)/(24*60*60))+date(05/17/11 17:10)
   The second term here gives the Julian date value.

Hope this works.

--Hideo Fujii
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000