date to number

Questions, tips and tricks and techniques for scripting in Servoy

date to number

Postby Harjo » Fri Jan 30, 2004 3:41 pm

Is it possible to convert a DATETIME, to a unique number?
and vice versa?
unique number to a DATETIME?

Like in Filemaker you can do with date to number and number to date!
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby IT2Be » Fri Jan 30, 2004 3:46 pm

DateTime already is a unique number...

Use yourdatetime.getMilliseconds();
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Harjo » Fri Jan 30, 2004 4:00 pm

I don't get it!

this does not work!
It always returns value: 417

:?:

field: setvervaldatum (DATETIME) dd-MM-yyyy
calculated field (INTEGER): return setvervaldatum.getMilliseconds();
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby IT2Be » Fri Jan 30, 2004 4:09 pm

With me, under os x I don't get the same value like you but the value is very low and bouncing up and down instead of adding up...

In JavaScript this really is the function we need for this so I think there is something wrong here :?
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby bcusick » Sat Jan 31, 2004 1:42 am

HJK wrote:I don't get it!

this does not work!
It always returns value: 417

:?:

field: setvervaldatum (DATETIME) dd-MM-yyyy
calculated field (INTEGER): return setvervaldatum.getMilliseconds();


Try this:

calculated field (INTEGER): return setvervaldatum.getTime()

returns: 1075449600000 (date: 01/30/2004 [MM/dd/yyyy])

Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA


Return to Methods

Who is online

Users browsing this forum: No registered users and 3 guests

cron