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 for Programming
 Forum for Origin C
 Date formating in GetNBox

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
memorialsb Posted - 10/18/2004 : 4:50:49 PM
Origin Version (Select Help-->About Origin): v7.5853
Operating System: Win 2000

Quick question,

Is there a way to drop a date format on a GetNBox dialog?

I want to do something like this:

Dialog Title
------------
Worksheet: Data1
Date of aquisition: 10/18/04
Elapsed days: <10/18/04 - StdDate>
<Other Data & fields ....>


Essentially I'm creating a dialog with the GetN_Tree that the user would specify when the data was acquired, and the dialog would automatically update (or at least be able to compute internally) how many days have elapsed since a standard date. The dialog then goes on with other fill in the blank sorts of questions.

I've thought about trying to convert the string to a time_t and subtracting that way, but it seems like a lot of trouble unless there was an easier way through OriginC or LabTalk.

-Matt


Matthew Meineke
mmeineke@memoralsb.org

Edited by - memorialsb on 10/18/2004 4:57:18 PM
2   L A T E S T    R E P L I E S    (Newest First)
memorialsb Posted - 10/18/2004 : 6:14:16 PM
Thanks,

Test code pretty much works as expected:


string dateFrmt = "MM'/'dd'/'yyyy";
string stdDate = "9/21/2004";
string dateAcquired = "10/18/2004";

double stdDateVal;
double dateAcquiredVal;
double diff;

str_to_date_custom(stdDate, dateFrmt, &stdDateVal);
str_to_date_custom(dateAcquired, dateFrmt, &dateAcquiredVal);

diff = dateAcquiredVal - stdDateVal;

printf( "stdDate = %lf;\n"
"dateAcquired = %lf;\n"
"diff = %lf days\n",
stdDateVal, dateAcquiredVal, diff );


Gives the following:


stdDate = 2453269.000000;
dateAcquired = 2453296.000000;
diff = 27.000000 days


So this will work for now.

-Matt

Matthew Meineke
mmeineke@memoralsb.org
cpyang Posted - 10/18/2004 : 5:16:34 PM
I am afraid you will need to do this using strings for now. We are planning to make this easier in Origin8, but for the time being, consider the following functions that you have access to,

1. converting a date string (short format) into Julian Day

str_to_date_custom

2. convert a Julina Day (double) into a string
date_to_str_custom

or use LabTalk notation "Dn" where n is the index into date format drop down

DoubleToStr(dVal, szBuff, nBuffSize, "D9");


CP





Edited by - cpyang on 10/18/2004 8:00:08 PM

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