Wrong Date in SuiteScript - netsuite

I want to get today's date in SuiteScript, when I type var tDate = new Date(); it shows me yesterday's date while debugging. I checked settings, there I couldn't see anything wrongly.
I am editing to this question. Most confusing thing is sometimes new Date () shows correct Date without any changes. No idea why it's acting like this. I added result of 'new Date()' as a picture right below.
In the first picture I captured on 1st of February, that shows me 31st of January which is wrong
In the second picture I captured today, that shows me today's date which is correct.

new Date() will give you the current timestamp according to the timezone of whatever system is running the code. In your browser console, new Date will give you the current timestamp in local time; in a server-side script, new Date will give you the current timestamp according to the timezone of your NetSuite data center.
How are you running this code, and what timezone are you yourself in?

Related

Amazon Quicksight Dynamic date filter

so everyday I receive sales data from the previous day. So today November 15 I have data from July 2021 until November 14 2021. What I want is to show this data for the current month by aggregating by day. I use a quicksight visual with a MTD (Month To Date) filter. Everything is fine so far.
The problem is on each first date of the month, I see "No Data" on my visual which is normal since I do not have any data from the current day/month but as I said earlier from the day before.
So what I want to achieve is:
Each 1st of current month: show data from the whole previous month
From 2nd to last day of current month: show data from the current month
Can someone help me please to know how I can achieve this?
I looked for ways to do this and I found dynamic default parameters but this option is not fine with me since I have to fill a username column according to the documentation (https://docs.aws.amazon.com/quicksight/latest/user/parameters-set-up.html) and I have many users so it will be not interesting to list all of them.
You can assign parameters to a group rather than a specific user which is much quicker
There is new functionality which allows you to set today or beginning/ending of month/quater/year as default.
See screenshot:
enter image description here

How do you get the day out of a Date object since "getDay()" is deprecated?

When the user opens my app the date is recorded. Then it's compared with the last date that was recorded. I want to be able to tell if just the day changed between the 2. And I don't want to simply see if 24 hours lapsed. The user should be able to open the app at 11:59pm, and then again in 2 minutes and the code should tell that the day has changed. Thanks for your help!
I found a solution that solves my problem (although technically doesn't directly get the day out of the Day object.)
Comparing two java.util.Dates to see if they are in the same day
Basically make a Calendar object and call it's "setTime()" method with my Date object as the argument, then use ".get(Calendar.DAY_OF_YEAR) to get the day from each Calendar object.
You are right, and if you want to get the actual day you just need to use Calendar.getInstance() like this:
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DAY_OF_MONTH);

Is there a recent or known issue with the #flurry Dashboard?

Our #flurry App Activity dashboard appears bugged. It only queries data from the first of every month, independent of the date range requested. Is this a known issue or recent bug? Everything was working fine just five days ago, and we haven't changed anything on the code side. Image of the current dashboard below:
Bugged App Activity Dashboard
Since you are looking at monthly data, Flurry pulls the whole month for any dates in your date range. Here it is showing all of August and September to date. If you want only September, you can change your dates to start September 1st. (Note that there is a time zone issue that can impact date selection, so you may need to change the first date to September 2nd in the date selector.) Alternatively, you could change your time grain to weekly or daily. Feel free to contact support#flurry.com if you'd like more assistance.

DTPicker Properties can't set custom date format correctly

For my Date Time Picker in Excel, I want to change the date format from 7/1/2020 to 2020-01-07 (yyyy-mm-dd).
So I went to DTPicker Properties and set the CustomFormat.
But when I went to check on the actual box, the date gives me 2020-00-07...
Even when I change the month to February, the month still remains 00. Same for when I move back to 2019.
What's the issue here?

Excel Date function and Time function in one formula

I have the following formula
DATE(YEAR(E687);MONTH(E687);DAY(E687))
and I want to use the TIME function as well. E.g:
DATE(YEAR(E687);MONTH(E687);DAY(E687)) - Time(10;0;0)
The reason is that I have guys working on my Excel sheetfrom CAT and PST
I am getting a date from the server and if a PST user adds data I want to minus 10 hrs from the server date to ensure I get the correct data in CAT.
I know my date above only shows date and not time but I want to remove 10hrs so see if it was done the previous day or the same day.
As comments on post suggests make sure your excels separation symbol e.g ; or , - Check regional settings.
Worked!

Resources