• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Calculate date from present day

Explorer ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

Hi!

 

Im totally new in everything relatied to programming, but im trying to do little project of mine and learning while doing it. Im stuck at this simpe coding, which i cant reslove no matter how i try.

 

I need to make ona frame which i will get by click of button and then it would tell me todays date, +3 days date, +10days date, and +120 days date.Can someone help me pls

 

thanks

Views

554

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

as3 or js?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

as3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

for whatever number of days you want, create a date object by using dateF().  you can then use it's properties (day, date, month, year etc to display what you want).

 

var d:Date = new dateF(days); 

var d:Date = dateF(days);

// for example, for 3 days from today, var d3:Date = new dateF(3);

var d3:Date = dateF(3);

// for 120 days from today var d120 = new dateF(120);

var d120:Date = dateF(120);

 

///////////// no need to edit /////////////////

function dateF(days:int):Date{

var d:Date = new Date();

return new Date(d.time+timeF(days));

}

function timeF(days:int):Number{
return days*24*60*60*1000;
}

////////////////////////////////////////////////////////

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

well thanks...and how can i put that in dd/mm/yyyy format, UTC...I did have
some code which tranform my time in milliseconds then puts it back in time,
but output for that is in looooong format with time and seconds etc. i dont
need that. I need dd/mm/yyyy format in my designated text input box...when
i clixk button on my present frame, it takes me to this one with all
calculations there in seperate boxes

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

d120.date+"/"+d.120.month+"/"+d120.year

 

(or maybe d120.fullYear)

 

check the as3 date api.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

One more question...i want to make menus...in thisnformat

+ blablabla
+ blsblabla
+ blsbksbla
+blabllabka
+ anotheblablabka

Hiw to do it?

So user click those and it opens, until final one, then opens frame...thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

Hi.

 

Maybe @kglad can answer your latest question here, but I think it would be better for you to create another topic so that it will easier for other users to find the possible answers you will receive.

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

@Karlo283052097pk9 

 

i didn't understand your menu question.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

so...i have one frame. with all the text as follows

+ blabla
+ bla bla
+ blabla
+ blsbka
+ blabla
- blabla
i have menu item blabla...and when user hits "+" , submenu
appears...etc....until "-", thats the last submenu item which opens some
frame etc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Copy link to clipboard

Copied

use a combobox component.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

How to make it visible in text box?

 

melb.text = theNewDatenew.toString();

 

like that or?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

melb.text = d120.date+"/"+(d120.month+1)+"/"+d120.fullYear;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

Scene 1, Layer 'Actions', Frame 640, Line 7 1048: Method cannot be used as a constructor.

 

var d:Date = new dateF(days);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

var d3:Date = new dateF(3);

///////////// no need to edit /////////////////

function dateF(days:int):Date{

var d3:Date = new Date();

return new Date(d3.time+timeF(days));

}

function timeF(days:int):Number{
return days*24*60*60*1000;
}


melb.text = d3.date+"/"+(d3.month+1)+"/"+d3.fullYear;

////////////////////////////////////////////////////////

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

that's my error.  it should be:

 

var d:Date = dateF(days); 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

var rightNow = new Date();
var msRightNow = rightNow.getTime();

var threeDays = 3 * 24 * 60 * 60 * 1000;
var tenDays = 10 * 24 * 60 * 60 * 1000;
var hundredDays = 120 * 24 * 60 * 60 * 1000;

var finalTime3 = msRightNow + threeDays;
var finalTime10 = msRightNow + tenDays;
var finalTime100 = msRightNow + hundredDays;

var theNewDate3 = new Date(finalTime3);
var theNewDate10 = new Date(finalTime10);
var theNewDate100 = new Date(finalTime100);

melb.text = theNewDate3.dateUTC + "-" + (theNewDate3.monthUTC + 1) + "-" + theNewDate3.fullYearUTC;
melc.text = theNewDate10.dateUTC + "-" + (theNewDate10.monthUTC + 1) + "-" + theNewDate10.fullYearUTC;
meld.text = theNewDate100.dateUTC + "-" + (theNewDate100.monthUTC + 1) + "-" + theNewDate100.fullYearUTC;

I had these on Flas CS6, and it worked flawless. Now on Animate, i get wierds dates, without some digits...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

var rightNow = new Date();
var msRightNow = rightNow.getTime();

var threeDays = 3 * 24 * 60 * 60 * 1000;
var tenDays = 10 * 24 * 60 * 60 * 1000;
var hundredDays = 120 * 24 * 60 * 60 * 1000;

var finalTime3 = msRightNow + threeDays;
var finalTime10 = msRightNow + tenDays;
var finalTime100 = msRightNow + hundredDays;

var theNewDate3 = new Date(finalTime3);
var theNewDate10 = new Date(finalTime10);
var theNewDate100 = new Date(finalTime100);

melb.text = theNewDate3.dateUTC + "-" + (theNewDate3.monthUTC + 1) + "-" + theNewDate3.fullYearUTC;
melc.text = theNewDate10.dateUTC + "-" + (theNewDate10.monthUTC + 1) + "-" + theNewDate10.fullYearUTC;
meld.text = theNewDate100.dateUTC + "-" + (theNewDate100.monthUTC + 1) + "-" + theNewDate100.fullYearUTC;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

Image4.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

As you see , only 7 digits are present???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

LATEST

I figure it out, i had to embed font in each text area

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines