DateTimeStamp

Questions, tips and tricks and techniques for scripting in Servoy

DateTimeStamp

Postby IT2Be » Tue Oct 28, 2003 12:06 pm

I want to apply a DateTimeStamp to a Field that is formatted the way I want it to be formatted with .toLocaleDateString.

As far as I noticed I have to create a date for that like I did below. But... Notice the differenct in the shown time against showing only getTimeStamp.

Is there something I do wrong. I work with rc5, OS X 10.3 and Dutch locale settings...

var t = new Date(application.getTimeStamp().getYear(),application.getTimeStamp().getMonth(),application.getTimeStamp().getDate(),application.getTimeStamp().getHours(),application.getTimeStamp().getMinutes(),application.getTimeStamp().getSeconds());
note = t;

--> Sun Oct 29 10:57:10 CET 0103

note = application.getTimeStamp();

--> Tue Oct 28 10:57:50 CET 2003
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby maarten » Tue Oct 28, 2003 1:53 pm

you are getting new (different) timestamps multiple times, which probably causes the difference.

Try this:
var t = new Date() //get's current datetime
t = t.toLocaleDateString()


FYI:(check the utils node in the method editor)
//format a date to a text representation
utils.dateFormat(orderdate,'EEE, d MMM yyyy HH:mm:ss');
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby IT2Be » Tue Oct 28, 2003 2:35 pm

Thanks, solved!
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany


Return to Methods

Who is online

Users browsing this forum: No registered users and 4 guests