Is It Possible the day Date (001...366)?

Questions, tips and tricks and techniques for scripting in Servoy

Is It Possible the day Date (001...366)?

Postby cuoredisardegna@tiscali.i » Sat Mar 05, 2011 8:38 pm

Hi to All,
is it possible to obtain the day Date in the consecutive year's days form (001...366) .
Tanks in advance.
Gianni Pinna.
cuoredisardegna@tiscali.i
 
Posts: 151
Joined: Sun Feb 29, 2004 10:35 pm
Location: Sassari

Re: Is It Possible the day Date (001...366)?

Postby ROCLASI » Sat Mar 05, 2011 9:41 pm

Hi Gianni,

Yes this is possible. For example in the module mod_datejs you find on ServoyForge (which is based on datejs) has a function that does this.
Essentially it does the following:
Code: Select all
function getDayOfYear(_dDate) {

     // get milliseconds of the date and substract the milliseconds of the first day of that year
     // then calculate that back into days (1 day == 86400000 milliseconds)

     return Math.ceil( (new Date(_dDate.getFullYear(), _dDate.getMonth(), _dDate.getDate()) - new Date(_dDate.getFullYear(), 0, 1)) / 86400000) + 1;
}


Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Is It Possible the day Date (001...366)?

Postby cuoredisardegna@tiscali.i » Mon Aug 29, 2011 9:20 pm

Dear Robert,
I have to sincerly and profoundly be grateful and excuse with You.
Infact You promptly and efficiently posted me the solution to the DayDate problem, and only now I can write You.
I have had a tribulation period. Omnia in bonun. .
A mindful and grateful thought of esteem.
Gianni Pinna.
cuoredisardegna@tiscali.i
 
Posts: 151
Joined: Sun Feb 29, 2004 10:35 pm
Location: Sassari

Re: Is It Possible the day Date (001...366)?

Postby ROCLASI » Mon Aug 29, 2011 11:51 pm

Hi Gianni,

Absolutely not a problem.
I hope all is well with you.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium


Return to Methods

Who is online

Users browsing this forum: No registered users and 8 guests