Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I need to know if the date is saturday or sunday or holiday.

  1. #1
    Junior Member
    Join Date
    May 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need to know if the date is saturday or sunday or holiday.

    def calcularFechas() {

    Calendar calendario = Calendar.getInstance();
    Calendar calendario1 = Calendar.getInstance();
    Date fechaActual
    Date fechaInicio
    Date fechaFin

    calendario.add(Calendar.DAY_OF_YEAR, 1);
    calendario.set(Calendar.MILLISECOND, 0);
    calendario.set(Calendar.SECOND, 0);
    calendario.set(Calendar.MINUTE, 0);
    calendario.set(Calendar.HOUR, 0);
    fechaInicio = calendario.getTime();

    calendario.add(Calendar.DAY_OF_YEAR, 1);
    calendario.set(Calendar.MILLISECOND, 0);
    calendario1.set(Calendar.SECOND, 59);
    calendario1.set(Calendar.MINUTE, 59);
    calendario1.set(Calendar.HOUR, 23);
    fechaFin = calendario1.getTime();

    render("Inicio: " + fechaInicio + " Fecha fin: " + fechaFin + " día: ")

    }

    Hello
    In this code I need to know if a day is Saturday, Sunday or public holiday thanks

  2. #2
    Junior Member
    Join Date
    May 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need to know if the date is saturday or sunday or holiday.

    def calcularFechas() {

    Calendar calendario = Calendar.getInstance();
    Calendar calendario1 = Calendar.getInstance();
    Date fechaActual
    Date fechaInicio
    Date fechaFin

    calendario.add(Calendar.DAY_OF_YEAR, 1);
    calendario.set(Calendar.MILLISECOND, 0);
    calendario.set(Calendar.SECOND, 0);
    calendario.set(Calendar.MINUTE, 0);
    calendario.set(Calendar.HOUR, 0);
    fechaInicio = calendario.getTime();

    calendario.add(Calendar.DAY_OF_YEAR, 1);
    calendario.set(Calendar.MILLISECOND, 0);
    calendario1.set(Calendar.SECOND, 59);
    calendario1.set(Calendar.MINUTE, 59);
    calendario1.set(Calendar.HOUR, 23);
    fechaFin = calendario1.getTime();

    render("Inicio: " + fechaInicio + " Fecha fin: " + fechaFin + " día: ")

    }

    Hello
    In this code I need to know if the fechaFin is a Saturday, Sunday or public holiday, thanks

Similar Threads

  1. Splitting date string by date and time and assigning it to 2 variables
    By KaranSaxena in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 17th, 2014, 05:58 AM
  2. Java Date Format in Date Object
    By Ashr Raza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 13th, 2012, 10:47 AM
  3. Replies: 1
    Last Post: July 22nd, 2011, 07:08 AM
  4. same date should entered in another date field
    By shashib09 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: July 14th, 2011, 08:42 AM
  5. Holiday
    By Freaky Chris in forum The Cafe
    Replies: 4
    Last Post: June 21st, 2009, 10:56 AM