Change image based on time – General Web Dev – SitePoint Forums

Hey, I’m making Lens/Filters for Snapchat in which the language used is java and I don’t know much about java. So I’m trying to create a lens/filter where the image changes depending on the time, for example if it’s between 8:30pm and 9pm it shows image 1 and between 9pm and 10:34pm it shows image 2 .
and I don’t have a script for it but I have a script in which the photo changes depending on the weather
so please can anyone help me create a script or modify the one i have (below)
Thank you!

(This //input command is used to add a UI where I add an image)

//@input Component.SpriteVisual dayOfWeekSprite
 
//@ui {"widget": "separator"}
 
//@input Asset.Texture sundayTexture
//@input Asset.Texture mondayTexture
//@input Asset.Texture tuesdayTexture
//@input Asset.Texture wednesdayTexture
//@input Asset.Texture thursdayTexture
//@input Asset.Texture fridayTexture
//@input Asset.Texture saturdayTexture
 
var date = new Date();
var day = date.getDay();
 
switch( day )
{
    case 0:
        print( "Sunday" );
        setSpriteTexture(script.dayOfWeekSprite, script.sundayTexture);
        break;
    case 1:
        print( "Monday" );
        setSpriteTexture(script.dayOfWeekSprite, script.mondayTexture);
        break;
    case 2:
        print( "Tuesday" );
        setSpriteTexture(script.dayOfWeekSprite, script.tuesdayTexture);
        break;
    case 3:
        print( "Wednesday" );
        setSpriteTexture(script.dayOfWeekSprite, script.wednesdayTexture);
        break;
    case 4:
        print( "Thursday" );
        setSpriteTexture(script.dayOfWeekSprite, script.thursdayTexture);
        break;
    case 5:
        print( "Friday" );
        setSpriteTexture(script.dayOfWeekSprite, script.fridayTexture);
        break;
    case 6:
        print( "Saturday" );
        setSpriteTexture(script.dayOfWeekSprite, script.saturdayTexture);
        break;
}
 
function setSpriteTexture(sprite, texture)
{
    if(sprite && texture){
        script.dayOfWeekSprite.mainMaterial.mainPass.baseTex = texture;
    }
}


James S. Joseph