View previous topic :: View next topic |
Author |
Message |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Mon Mar 21, 2005 1:57 pm Post subject: DateTime confusion... |
|
|
Im using VDS4 if this makes a difference.
This program I'm creating inserts a task into the Windows task scheduler on the next day. So I need to add a day to the current date. I know with @datetime() I can get a floating point number, but how can I add a number to it and get a date back out?
I realize that I could probably use datetime.dll, but if its simple enough to do, I'd like to avoid that.
Thanks for your awesome help as usual guys. |
|
Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Mar 21, 2005 2:41 pm Post subject: |
|
|
as i understand it, when vds returns a date as a decimal then the integer part deals with the date while the decimal deals with the time
eg. 2345.6789 would have 2345 dealing with the date, so adding 1 to it will give you the next day's date, and .6789 deals with the time
serge _________________
|
|
Back to top |
|
 |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Mon Mar 21, 2005 2:45 pm Post subject: |
|
|
Yes, but how to I get that number back into a date format, like 3/21/05? |
|
Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Mar 21, 2005 2:49 pm Post subject: |
|
|
@datetime(dd/mm/yy,234.5678) should do it
serge _________________
|
|
Back to top |
|
 |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Mon Mar 21, 2005 3:24 pm Post subject: |
|
|
Similar problem...
I need to add 2 minutes to the time. Is there a breakdown of what floating point number is the minutes in @datetime()?
BTW, thanks TONS for your help. |
|
Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Mar 21, 2005 3:40 pm Post subject: |
|
|
yes there is, someone posted a while back what the decimal number is for a minute, a second but i don't remember when and where
do a search at the forum and see if you can find it
serge _________________
|
|
Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Mon Mar 21, 2005 4:30 pm Post subject: |
|
|
I wonder about you guys sometimes.
A minute is 1 / 24 / 60. You can use the Windows calculator to work it out. Since I can never remember the value I do it all the time. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
 |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Mon Mar 21, 2005 4:56 pm Post subject: |
|
|
jules wrote: | I wonder about you guys sometimes.
A minute is 1 / 24 / 60. You can use the Windows calculator to work it out. Since I can never remember the value I do it all the time. |
Do you really wonder about me when I say that I still don't understand? |
|
Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Mon Mar 21, 2005 5:37 pm Post subject: |
|
|
Flypaper,
1 day = 1.0 in VDS time/date format.
There are 24 hours in a day, so 1 hour = 1 divided by 24.
There are 1440 minutes in a day, or 60 minutes in an hour,
so 1 minute = 1 divided 1440, or 1 divided by 24 divided by 60 (Jules equation).
There are 82400 seconds in a day, so 1 second = 1 divided by 82400,
or 1 divided by 24 divided by 60 divided by 60.
I hope this helps...
Hooligan _________________ Hooligan
Why be normal? |
|
Back to top |
|
 |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Mon Mar 21, 2005 7:43 pm Post subject: |
|
|
That took me a few minutes to wrap my small brain around, but i understand whats going on now. thanks guys! |
|
Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Mar 21, 2005 11:11 pm Post subject: |
|
|
Quote: | I wonder about you guys sometimes. Wink |
i realised about how to work it out after the post when my computer was switched off...can't help it if i am a bit slow sometimes
serge _________________
|
|
Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Mar 21, 2005 11:18 pm Post subject: |
|
|
Quote: | Do you really wonder about me when I say that I still don't understand? |
flypaper,
i'm afraid that he is talking about me - for a long time i wondered about how long a vds second was a decimal and then it dawned on me after my post above, but it was too late for me to tell you or work it out as i had logged off and switched off my desktop
serge _________________
|
|
Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
Back to top |
|
 |
|