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
votes
2answers
35 views

How to change the 2021-06-15 to date(15/06/2021) in Apex? [closed]

1.How to change the 2021-06-15 to date(15/06/2021) in Apex? And I was new to apex.
0
votes
2answers
27 views

Changing of date format in apex

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
28 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
39 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
38 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
51 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
58 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
47 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
46 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
36 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
27 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
51 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 ...
0
votes
0answers
29 views

Half date from Two date fields store in date field

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 ...
-3
votes
1answer
33 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
158 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
43 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
78 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
45 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
39 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
42 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
58 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
39 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
61 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
28 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
42 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
75 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
60 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
16 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
58 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
195 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
19 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
143 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
93 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
44 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
39 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
301 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
85 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
46 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 ...
0
votes
1answer
20 views

Constructor not defined error - error after setting date fields as null during object creation

I have created a wrapper class to create an Object and send it as a request to a third party system. It was working well. But after I added a two new arguments of the Datatype Date, I am getting the ...
3
votes
1answer
336 views

Why some classes cannot be constructed?

when I started learn Apex, I was confused, because I cannot create date instance like: Date date = new Date(); I had to use static method Date date = Date.newIstance(...); So, why i must use static ...
0
votes
1answer
55 views

LWC HTML title attribute showing bad value

Hi need some help on the setting the title attribute dynamically of the date field in the lightning formatted date for my LWC value which is being get displayed on the screen from the incoming value ...
0
votes
0answers
41 views

Date and time formatting in salesforce

Hi I need to convert the below date and time in the readable format is there any way because this value is coming from service and i am not understanding how to change this into readable format. Value ...
0
votes
1answer
13 views

How do I populate individual dates using addDays() onto a series of child records?

To give you some context, I'm writing a trigger between a parent-child relationship ("Event" - "Day"). When entering number of days into the Event__c object, I would like to ...
0
votes
1answer
279 views

I want to create a method in apex to check if the date format is in 'mm/dd/yyyy'

I have created this but getting an error>> "Condition expression must be of type Boolean: String" public static boolean validateDateFormat(String date1){ DateTime validDate = ...
0
votes
0answers
54 views

Calender not coming up on VF page input field

I have below VF page code . I am fetching values from controller . So there are mix of data types coming from it which are date type ,string ,integer . <apex:pageBlockSection title="Inputs&...
1
vote
1answer
31 views

Modifying a Dynamic Date Range by Month with AMPScript in Email

this might be helpful for some, but I also feel like it might be able to be improved upon or simplified. I have a recurring email campaign once a month that offers a new promotion for the course of ...
1
vote
1answer
52 views

SSJS DataExtension.Add FieldType Date… What does the “Ordinal” parameter mean?

I'm building a Data Extension using SSJS for the first time and the documentation is horrible. There's no syntax guide for the various field types. I'm wondering what the purpose of the "Ordinal&...
0
votes
1answer
81 views

Can Wait By Attribute honour the dynamic dates in Journey?

I have a 'Wait by Attribute' in my Journey which is referring to a date attribute in a data extension from contact builder. I then have a SQL criteria to change the Date values based on certain ...

1
2 3 4 5
13