Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,890 questions

51,817 answers

573 users

How to format day of week in Java

2 Answers

0 votes
package javaapplication1;

import java.text.SimpleDateFormat;
import java.util.Date;

public class JavaApplication1 {
    
    public static void main(String[] args) {
  
        Date date = new Date();
    
        SimpleDateFormat sdf = new SimpleDateFormat("E");

        System.out.println("E format: " + sdf.format(date));

        sdf = new SimpleDateFormat("EEEE");
        System.out.println("EEEE format: " + sdf.format(date));
    }  
}
   
/*
   
run:
   
E format: Sun
EEEE format: Sunday
   
*/

 



answered Oct 30, 2016 by avibootz
0 votes
package javaapplication1;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;

public class JavaApplication1 {

    public static void main(String[] args) {

        Format formatter = new SimpleDateFormat("EEEE");
        String s = formatter.format(new Date());
        System.out.println(s);
    }
}
   
/*
   
run:
   
Sunday
   
*/

 



answered Oct 30, 2016 by avibootz

Related questions

4 answers 205 views
1 answer 131 views
1 answer 232 views
1 answer 174 views
1 answer 119 views
119 views asked Oct 30, 2016 by avibootz
...