Skip to main content
Known Participant
October 17, 2024
해결됨

HOW TO SET A JAVA FILE EXPIRY DATE ?

  • October 17, 2024
  • 3 답변들
  • 4524 조회

 

I already have a java script, I want to add expiry date in it, how to do it. Please give me the code. and how to do it

 

이 주제는 답변이 닫혔습니다.
최고의 답변: Stephen Marsh
var today = new Date();
alert(today);

How to add this code??

 


quote
var today = new Date();
alert(today);

How to add this code??

 


By @MJ ST

 

You would research how to work with dates with JavaScript, among a few other things.

 

Here is a working demo for you. It is not guaranteed to be fit for purpose or covered by warranty. Use at your own risk!

 

/*
Today's date: 2024-10-18
Expires tomorrow: 2024-10-19
*/

// Get today's date
var today = new Date();
var year = today.getFullYear().toString();
// Extract the month... Months are zero indexed, so add one!
var month = ("0" + (today.getMonth() + 1)).slice(-2);
var date = ("0" + today.getDate()).slice(-2);
var yyyymmdd = year.toString() + month.toString() + date.toString();
// Convert the string back to a number
yyyymmdd = parseInt(yyyymmdd);

// Conditional
if (yyyymmdd < 20241019) {
    // Add your code below. Remove the following alert...
    alert("Pass");
} else {
    // Do nothing on fail. Remove the following alert...
    alert("Fail");
}

 

3 답변

Stephen Marsh
Community Expert
Community Expert
October 21, 2024

Cross posted here:

 

<merged link removed>

 

MJ ST작성자
Known Participant
October 21, 2024
Legend
October 18, 2024

This is not Java and has nothing to do with writing an Android app.

Legend
October 17, 2024

This makes no sense. Javascript files don't have expiration dates. Can you give a better explanation?

Stephen Marsh
Community Expert
Community Expert
October 18, 2024

@Lumigraphics 

 

I’m guessing that this is an attempt at some sort of "licensing" or "time-limited working demo" for a script (not an extension/panel). But guess is just that, a guess. 

 

@MJ ST - Can you expand on your post?

MJ ST작성자
Known Participant
October 21, 2024

This is not the "I need you to write code for free" website. We can help, but its up to you to do the work or pay someone to do it for you. I don't think this whole endeavor is going to work the way you think it will.


Is there a way to set an expiration date on a JSX. file?
So that it cannot be opened after a certain time?

 

I already have a jsx photoshop using script, I want to add expiry date in it, how to do it. Please give me the code. and how to do it