| View previous topic :: View next topic |
| Author |
Message |
hzman General User

Joined: 13 Dec 2008 Posts: 6
|
Posted: Wed Jan 11, 2012 3:26 am Post subject: [SOLVED] NOW() not working so good... |
|
|
Hi, I have this macro assigned for a button:
[code]
sub ButtonPressed (oEv as object)
dim oForm as object
dim oField as object
dim idate as long
idate=now() -2
oForm = oEv.source.model.parent
oField=oForm.GetByName("datSaapumispvm")
oField.BoundField.value=idate
end sub
[/code]
Date I get from this is two days ahead... so with (-2) I get the right date for the datSaapumispvm. TODAY gives me 1.1.1900, and DATE gives also two days ahead...
Any idea why it is so?? Computer time is right, Windows 7, OpenOffice 3.3.0.
Thanks, Hermanni
Last edited by hzman on Thu Jan 12, 2012 1:14 am; edited 1 time in total |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
|
| Back to top |
|
 |
hzman General User

Joined: 13 Dec 2008 Posts: 6
|
Posted: Wed Jan 11, 2012 7:35 am Post subject: Not really help. |
|
|
Hi, thanks for the link, but none that I have tried helps.
If I use idate as STRING then the value of the idate includes "-marks ("11.1.2012"), and it gives me a date 01.01.1800 to datSaapumispvm field. If I use idate as LONG then the value is 11 (today) and it gives me a result of 12.01.1900...
NOW() function gives me a result of 40920 (when idate is LONG), which ends up being 14.1.2012 in datSaapumispvm field, so at the moment 3 days ahead... ????
I have msgbox(idate) in my code so I can see what the idate is before it goes to datSaapumispvm.
Hermanni |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Wed Jan 11, 2012 9:03 am Post subject: |
|
|
Hello
If none of them work I don't have any idea what is wrong.
Romke |
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Wed Jan 11, 2012 9:14 am Post subject: |
|
|
Hello
I think you add a value to a date field and it can be better to add a string to the date field. I have learned from Villeroy that there is a different between numbering in date between OOo and what is used in SQL.
Romke |
|
| Back to top |
|
 |
dacm Super User


Joined: 07 Jan 2010 Posts: 734
|
|
| Back to top |
|
 |
RPG Super User

Joined: 24 Apr 2008 Posts: 2696 Location: Apeldoorn, Netherland
|
Posted: Wed Jan 11, 2012 4:41 pm Post subject: |
|
|
Hello
I did place a more clear explanation in the thread.
Romke |
|
| Back to top |
|
 |
dacm Super User


Joined: 07 Jan 2010 Posts: 734
|
|
| Back to top |
|
 |
hzman General User

Joined: 13 Dec 2008 Posts: 6
|
Posted: Thu Jan 12, 2012 1:12 am Post subject: Found another way to do it |
|
|
I had no idea that you can have a dropdown calender for date-field in a form.
But that does the trick for me. Thanks everyone for good try, none of them worked for me though, or I just didn't know how to make these examples to work.
Hermanni |
|
| Back to top |
|
 |
|