Re: date math
This WebDNA talk-list message is from 2005
It keeps the original formatting.
numero = 61837
interpreted = N
texte = Since you have your date and time fields separated, you may need to create dates and times with them. By enclosing the whole thing in {} and setting it as a math variable, it will be in the form of an integer, which simplifies any calculations:[text]Emon=04[/text][text]Eday=20[/text][text]Eyr=2005[/text][text]EHr=11[/text][text]Emin=45[/text][text]Esec=45[/text]entered date as integer = [Math]Edate={[Emon]/[Eday]/[Eyr]}[/Math]entered time as integer = [Math]Etime={[EHr]:[EMin]:[Esec]}[/Math]Now do the same for the current date and time:today's date as integer = [Math]Tdate={[date]}[/Math]today's time as integer = [Math]Ttime={[time]}[/Math]Now subtract one from the other:elapsed days as integer = [Math]elapsedD=[Tdate] - [Edate][/Math]
elapsed time as integer = [Math]elapsedT=[Ttime] - [Etime][/Math]To convert back to days, hours, minutes and seconds, use the format tag:
[elapsedD] days, [Format Seconds_To_Time %H hours, %M minutes and %S seconds ago.][elapsedT][/Format]Dave HurleyBiology DepartmentUniversity of Washington> From: Eddie Z
> Date: April 20, 2005 3:05:10 PM PDT> Subject: Date Math>>> I'm really bad at using the date math features of WebDNA for some > reason.> Maybe someone could help me out. I am adding a countdown feature to my > site> and I need to know how much time there is in between the date of a > page load> and a date read from a database in years, months, days, hours, minutes > and> seconds.>> My database is broken down as follows:> ID#> Eyr> Emon> Eday> Ehr> Emin> Esec>> I've been working with the WebDNA Technical Reference all afternoon > and have> been unable to get the results I need. The only other way I can think > to do> it is by using a bunch of if/then statements. There must be an easier > way.>> Thanks,> Eddie-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Since you have your date and time fields separated, you may need to create dates and times with them. By enclosing the whole thing in {} and setting it as a math variable, it will be in the form of an integer, which simplifies any calculations:[text]Emon=04[/text][text]Eday=20[/text][text]Eyr=2005[/text][text]EHr=11[/text][text]Emin=45[/text][text]Esec=45[/text]entered date as integer = [math]Edate={[Emon]/[Eday]/[Eyr]}[/Math]entered time as integer = [math]Etime={[EHr]:[EMin]:[Esec]}[/Math]Now do the same for the current date and time:today's date as integer = [math]Tdate={[date]}[/Math]today's time as integer = [math]Ttime={[time]}[/Math]Now subtract one from the other:elapsed days as integer = [math]elapsedD=[Tdate] - [Edate][/Math]
elapsed time as integer = [math]elapsedT=[Ttime] - [Etime][/Math]To convert back to days, hours, minutes and seconds, use the format tag:
[elapsedD] days, [Format Seconds_To_Time %H hours, %M minutes and %S seconds ago.][elapsedT][/Format]Dave HurleyBiology DepartmentUniversity of Washington> From: Eddie Z > Date: April 20, 2005 3:05:10 PM PDT> Subject: Date Math>>> I'm really bad at using the date math features of WebDNA for some > reason.> Maybe someone could help me out. I am adding a countdown feature to my > site> and I need to know how much time there is in between the date of a > page load> and a date read from a database in years, months, days, hours, minutes > and> seconds.>> My database is broken down as follows:> ID#> Eyr> Emon> Eday> Ehr> Emin> Esec>> I've been working with the WebDNA Technical Reference all afternoon > and have> been unable to get the results I need. The only other way I can think > to do> it is by using a bunch of if/then statements. There must be an easier > way.>> Thanks,> Eddie-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Dave Hurley
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Progress !! WAS: Trouble with formula.db (1997)
NY taxRates.db? (1997)
RE: too many nested [xxx] (1997)
Empty Shopping Carts (1998)
Text data with spaces in them... (1997)
back one? (2000)
WebCat2.0 [format thousands .0f] no go (1997)
[/application] error? (1997)
Public beta 2 for WebCatalog 4.0 is now available. (2000)
Yet another db manager (2004)
SMSI: WebDNA Versions? (2002)
.. more on sliding discounts... (1997)
Almost a there but..bye bye NetCloak (1997)
empty order (2004)
protect tag on NT (1997)
counting characters and/or words (1997)
Candle Light Vigil (2001)
Remove from list server (1997)
Problems with webcat 2.01 for NT (1997)
how do ye do this?????? (2001)