Questions tagged [date]

A value that indicates a particular day. Unlike Datetime values, Date values contain no information about time

Filter by
Sorted by
Tagged with
1
vote
1answer
16 views

How to correctly convert Unix Timestamp to datetime in SQL

I'm trying to get the date format dd/MM/YYYY or anything readable. actually I have the date data with this format stocked in a string field "1620305130000" I have tried the following CONVERT(...
0
votes
0answers
30 views

Unable to create temporary data extension: Field name cannot contain the character ) convert to date

I'm trying to convert a timestamp data to a "dd/MM/YYYY" format, but I couldn't figure out the correct syntax. I've wrote this query but I'm getting this error message. Unable to create ...
0
votes
0answers
15 views

Salesforce Validity Date Logic

We are trying to integrate date logic to a custom object (e.g. Job Information) in Salesforce. Per employee (user) there can be only 1 record which is valid for a certain period. Following cases are ...
0
votes
1answer
35 views

Salesforce formula to get last day of previous month after one year

I have validation rule which will throw if the selected date is not last day of previous month after one year Example - today is Oct 1,2021 then my validation should fire if selected date is not Sept ...
0
votes
2answers
52 views

How can I make a year in a SOQL query variable?

So I can run a query such as WHERE Date__c > 2020-07-31 but then next year "2020" would be out of date. I'd like "2020" to be variable so that next year, when I run this again, ...
0
votes
1answer
23 views

JavaScript setHours is setting less hours than specified by parameter

function removeDaysToDate(date, hours){ var res = new Date(date); console.log('res ->' + res); console.log('hours ->' + hours); ...
0
votes
2answers
32 views

How to find different between two dates in aura Component?

I am try to get number of days between two dates. here is my code-- Var first = new Date('2021-09-01T03:24:00'); Var second = new Date('2022-09-02T05:24:00'); Var Difference = second.getdate() - first....
0
votes
1answer
21 views

Default Date/Time In Medium Format 28 Jan 2008, 16:30:05 instead of 28/01/2008, 16:30

Company would like to display the Date format in SF to show the month as text (e.g. Jan instead of 01). From the following article this appears to be the a OOB option by setting the users Local to ...
0
votes
1answer
29 views

Date.newInstance function not throwing error when we enter invalid date

I am using Date.newInstance for entering the date through the apex. For example : System.debug('Test1'+Date.newInstance(Integer.valueOf('2021'), Integer.valueOf('2'), Integer.valueOf('31'))); The ...
3
votes
1answer
61 views

Marketing Cloud - API - Data Extension - Filter by Date

I'm retrieving values from a Data Extension using the GET method on https://[YOUR SUBDOMAIN].rest.marketingcloudapis.com/data/v1/customobjectdata/key/[EXTERNAL_KEY]/rowset without any filter the ...
0
votes
2answers
47 views

Remaining days in a month

I am trying to calculate some amount depending on the days. For first month it will have only 15 days and the subsequent month will have full days and last month will have 25 days(First and last month ...
0
votes
1answer
105 views

Salesforce formula to calculate first day of next month

I am creating validation rule which will fire if date of a custom field is greater that first day of next month. I am using below formula in validation rule but it is not firing. Custom field is ...
-1
votes
2answers
71 views

Changing of date format in apex [closed]

1.How to change the 2021-06-15T02:30:00.000Z to date(15/06/2021) in Apex? I have tried multiple ways but not working please help me with the code.
0
votes
1answer
32 views

hour() and date() functions are returning wrong values

I am trying to get the hour and date of the user's local timezone by using the below code. now = Datetime.now(); offset = UserInfo.getTimezone().getOffset(now); local = now.addSeconds(offset/1000); ...
2
votes
1answer
193 views

Formatting problem with the Lightning Input date type

I am using the following two lightning inputs in a component I'm working on: <lightning:input name="startDate" type="date" dateStyle="short" value="{!v....
0
votes
1answer
41 views

Salesforce Date Formula doesn't show proper results

Hi Salesforce enthusiasts! I need to troubleshoot existing formula in my organization (or create a simpler one) "Contract Renewal Date" (see below) which is supposed to show the date: ...
0
votes
1answer
52 views

how to subtract/not consider a Date Range

I have field called CBN__c on child object Score and i need to rollup this to the parent account based on Approved Scores. I did create a batch class that updates Account's CBN field but i got a new ...
1
vote
1answer
77 views

How to find out which dates are missing in a period?

I have two dates (the start date of the period and the end date) that the user enters in the form to get a list of data. I need to get a list of this data from the database and check if there is a ...
1
vote
2answers
79 views

Apex - Count days or years between today and Date field (Registration date)

I need to make discount depends from Registration date (i.e. 3% discount to Opportunity when Accoun registered 1-2 years ago). Sample of code: for (Opportunity opp : TriggeredOpps){ If (...
0
votes
1answer
20 views

Subtracting Integer from Date returning previous date than expected date

We are trying to calculate "Date A" by subtracting 5 days from "Date B". For e.g Date myDate = Date.newInstance(2021, 06, 26); Date newDate = mydate.addDays(-5); System.debug('...
0
votes
1answer
146 views

can't solve invalid date in apex

I'm sending a date value from my lwc to apex. the date value comes from a lightning-input type date, so the format is year-month-day (for example, 2021-06-01). In apex, this is how I process it, very ...
0
votes
1answer
49 views

How do I pass the date period to the apex method?

I need to pass the date period "from" "to" from the js controller to the apex method in order to extract a list of values from the database. //cmp ... <aura:attribute name=&...
1
vote
1answer
36 views

How do I pass the date value from the js controller to the apex method?

Trying to pass the date value I get an error. How to fix it? //cmp ... <aura:attribute name="dateExchangeRates" type="Date"/> ... //js getDataForTheDate : function(component,...
1
vote
1answer
105 views

datetime format in the UI and DB

Why there is a datetime format so different as compare to what I see in the UI vs SOQL/APEX and I can not figure out what is going on. Can anybody please explain or what I'm doing wrong here? In the ...
-3
votes
1answer
37 views

Middle date from Two date fields [closed]

I have a Requirement where there are Two dates field (Delivery Date) and another field is (Delivery Date of Remaining Material) , I want to half value of date for eg Delivery date is 10/May/2021 and ...
1
vote
3answers
407 views

using today date in Database.getQueryLocator query String throwing errors

I am running a batch class. I am providing query in string format. I am facing issue with using a filter criteria StartDate__c>=:System.today() In a direct query, i could write something like List&...
0
votes
1answer
77 views

getDate() returns a day before the actual date

another issue with dates not working properly. I have a date field on my object. When selecting a date, I am using this in my js. let sDate = new Date(this.opportunity.data.fields.Start_Date__c.value);...
1
vote
1answer
80 views

Weird Date results

I am trying to pass a date to my obj and not sure why but the date changes for no reason and trying to see why. Anyone has a clue? for(var i = 0; i<this.scheduleMonths.length; i++){ ...
0
votes
1answer
54 views

SQL birthday reminder, leap year in Marketing cloud [closed]

i'm trying to sort out a result set that sorted by upcoming birthday. This works perfectly until leap years comes into play. For example: Nov 14 1991 - 200Days left Nov 13 1988 - 200Days left Here ...
1
vote
0answers
42 views

Date convert from DD/MM/YYYY to yyyy-mm-dd

This will not convert my date dd/mm/yyyy to yyyyy-mm-dd that I send through the frontend. HTML <div if:true={isMobile} class="slds-size--1-of-1 slds-large-size--1-of-2 padding_10"> ...
0
votes
1answer
106 views

Issue when using ISPICKVAL in formula

I have read the documentation and I am aware that picklist values need to use ISPICKVAL in the formula I want this formula to show that If the status is 'A' or 'B' it will show the days (in numbers) ...
0
votes
1answer
66 views

Date formatting not working properly [duplicate]

I have my locale set at (GMT-05:00) Central Daylight Time (America/Chicago). And I am using the below Apex. DateTime d2 = System.Today() ; system.debug('date is '+d2); // date is 2021-04-10 00:00:00 ...
0
votes
1answer
41 views

DateTime format behaves unexpectedly

I have a requirement to convert user time to CST and check user day with the CST day so the first thing is I am converting user Time to CST time by using the below ways Datetime cstTimeNow = ...
0
votes
1answer
60 views

dateTime.format returns incorrect value for time

I have below apex code. Datetime myCSTTimeNow = Datetime.now().format('yyyy-MM-dd HH:mm:ss','America/Chicago'); Datetime rightNowAsCST = Datetime.valueOfGmt(myCSTTimeNow); Integer ...
2
votes
1answer
78 views

French time format - date and hour

I need to adapt appointment date & hour US format to the french time format in Marketing Cloud. I have this code but nothing display in the email : %%[ VAR @firstname SET @firstname = ...
0
votes
1answer
30 views

Automation to prevent duplicate emails from sending a week apart

I have marketing cloud automation set up that puts our end users into one of 6 groups based on last character of their ID. Every month we send out an NPS Survey on the first Tuesday of every month and ...
0
votes
2answers
76 views

DateTime value difference in UI and Soql query

The external System updates the date time field as 2021-03-15T09:00:00.000+0000. When I query the SOQL is also returning the same value. But when EST time zone user logins, the record suppose to show ...
0
votes
2answers
160 views

Calculate number of years between two dates in formula field

I have two date fields: OrderApi__Paid_Through_Date__c and OrderApi__Activated_Date__c I have the following requirements: If Length of membership <1 year, display 5 If Length of membership 1-3 ...
0
votes
0answers
93 views

Einstein Analytics - SAQL - Compute expression in Dataflow - Convert date field to Quarter Year ("ie Q1 YYYY")

I am trying to create a new column that is able to take a date field and essentially turn it into a text string that indicates the quarter and year based on the date being pulled (i.e., if the month ...
1
vote
1answer
34 views

Calculate number of weeks left until expire date

I have a field called 'Membership_Expire_Date'. I want to calculate the total number of weeks left for a membership to expire. It is easy to calculate number of days with formula ...
0
votes
1answer
105 views

getMonth() reacting weird

I am trying to create an array of the months between the start date and end date. So far I am ok with it BUT I do have a weird case where when I am looking at my start date and using the getMonth(), ...
0
votes
1answer
290 views

How to convert DateTime format from 00:00:00 to 23:59:59

I have converted a Date into DateTime format, and it is returning me the hour format in 00:00:00 but I want it to be in 23:59:59 Date startDate = Date.newInstance(2021,2,1); This returns the output ...
0
votes
1answer
20 views

Create report where created date is 2020

How can I add filter on report where record created date is 2020? I mean I want all the records that were created in the year 2020. I tried many formulas like YEAR() -1 and YEAR() = 2020 but nothing ...
0
votes
1answer
237 views

System.SObjectException: Illegal assignment from String to Date

I am trying to create an sObject from a Json string but get the error: System.SObjectException: Illegal assignment from String to Date This happens in line: newSobject.put(sObjectFieldsMap.get(key), ...
0
votes
1answer
140 views

How to count an average date?

My accounts have the Date field Activity__c. How can I figure out an average date between all these Activity__c fields and define the closest date to the average date? I tried to use SOQL: [SELECT AVG(...
1
vote
2answers
46 views

Date Formatting issue in Apex?

I have date format something like this. I don't know how to format this and this value needs to used on a close date in Opportunities. Please help me to format this. I tried below but throwing errors ...
0
votes
1answer
42 views

difference of two date time field in days and hours

How can I show the difference of two date time fields in days and hours. I am trying to do this in a formula field or process builder. Example: 16/10/2021 11:00am - 15/10/2021 10:00am = 1 day 1 hour
4
votes
2answers
311 views

formatGMT YYYY returning next year and yyyy returning this year?

We noticed a behavior with formatGmt function especially around using YYYY vs yyyy, anyone facing the same? Below is showing one year ahead: system.debug('GMT Time'+System.now().formatGmt('E, dd MMM ...
0
votes
1answer
118 views

Date format in Marketing Cloud email based on locale

I am looking to show the date in two different formats based on locale (the locale variable is set to LocaleCode earlier in the email). For en-US it should be January 1, 2021 and all other locales it ...
1
vote
2answers
63 views

Convert number from date field to text and populate picklist field using execute anonymous

I'm updating data using execute anonymous (one-time update). The business wants me to replace date fields with picklist fields under a custom object called Category. The new picklist field should ...

1
2 3 4 5
13