de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Day of the Week
PostPosted: Thu Mar 27, 2014 11:57 pm 
Offline
Veteran
Day of the week

With the following command you get the numerical day of the month:

def text = Calendar.getInstance().get(Calendar.YEAR)+"-"+
Calendar.getInstance().get(Calendar.MONTH)+"-"+
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)+" "+
Calendar.getInstance().get(Calendar.HOUR_OF_DAY)+":"+
Calendar.getInstance().get(Calendar.MINUTE)+":"+
Calendar.getInstance().get(Calendar.SECOND));
show(text)

But how to determine the Day of the Week?

I would like to have something like this:

switch(Day) {
case Monday: .... ; break
case Tuesday: .... ; break
case Wednesday: .... ; break
case Thursday: .... ; break
case Friday: .... ; break
case Saturday: .... ; break
case Sunday: .... ; break
}

Thanks in advance.


Top
 Profile Send private message 
 
 Re: Day of the Week
PostPosted: Sat Mar 29, 2014 12:20 pm 
Offline
Site Admin
User avatar
Related to this previous subject : it's another constant from Calendar
Code:
def number = Calendar.getInstance().get(Calendar.DAY_OF_WEEK)

I think it's 1=sunday, 2=monday, etc., but not sure


Top
 Profile Send private message 
 
 Re: Day of the Week
PostPosted: Sat Mar 29, 2014 8:23 pm 
Offline
Veteran
Sometimes it's amazing, it is that simple! :)
Thanks!


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.