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
0
votes
1answer
32 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
39 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
34 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
262 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
47 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
30 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
17 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
92 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
29 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
34 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
42 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
43 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
21 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
26 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
42 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 ...
2
votes
1answer
24 views

What is the best way to correctly create a string with a time queried from SOQL which needs to be displayed to Germans?

We have a custom Datetime field on a custom object, Appointment__r.Start_Date__c. At 6pm, the day before the appointment, we must send every customer with an appointment an SMS which reminds them of ...
0
votes
0answers
11 views

How to get the current quarter start date and no. of days in the current quarter in apex [duplicate]

How to get the current quarter start date and no. of days in the current quarter
2
votes
1answer
58 views

Date.today() gives different dates on different classes

These are the two classes I have written: aura:component controller class public class ResourcesComponentClass { @AuraEnabled public static void getDate(){ Datetime dateObj = Date....
2
votes
2answers
33 views

Date problem in Apex

I am generating current date in the js controller class. And, in the helper class, When I call the Apex method I am sending the date to apex as parameters. Here's the code: //controller.js ...
1
vote
2answers
101 views

Converting Datetime to Date returns date in the past

Datetime conversion of a custom datetime field to a date value doesn't work correctly. This behavior isn't explained in Salesforce's documentation as far as I know. Set your org & user to Pacific ...
1
vote
1answer
94 views

How to filter on CreatedDate using a date range in SOQL?

I'm having problems trying to filter a query by CreatedDate using a date range. The query returns always a wrong set of records. For example, if I want to get all records created until 2020-07-28, it ...
0
votes
2answers
92 views

Display Month Name and Year based from Date field eg: September 2021

Any assistance would be much appreciated! Looking to build a formula field that extracts Month and Year of a custom date field. (if it is 28.09.2020 as the date then the formula field would display ...
0
votes
1answer
78 views

How to remove the time 00:00:00 from a date format and still maintain the date type

PROBLEM: I converted a string to Date format. Eg: String dateToParse = year+'-'+month1+'-'+day; Date ds = Date.parse(dateToParse); OUTPUT: 2020-07-24 00:00:00 (output is a Date type variable) Expected:...
1
vote
2answers
132 views

How to format a date in a javascript?possible [closed]

How can I format a date object to print as today instead of showing a numeric date in a javascript? I'd like to display it like this: today At 5:00 PM. js var today = new Date(); var date = new Date(...
0
votes
1answer
181 views

How to Blank Date value in Date formula field?

This field is to display the "date" value when this Opportunity's Stage value contains "Closed ". and at the same time Opportunity's Stage value not contains Closed means this ...
0
votes
1answer
50 views

How to format date field to ISO 8601 format?

I need to have a Date field send in an apex API callout in the format that matches this format "2019-05-28T19:40:36+00:00" I currently have the following: Datetime startDate = datetime....
0
votes
1answer
130 views

Convert date field to ISO 8601 format in REST API Post Callout

The external site that I'm trying to send Salesforce data to, requires that all dates/datetimes must be in ISO 8601 format. I am curious about how to accomplish this within my Apex class. The field ...
1
vote
2answers
43 views

Salesforce date format

The system I'm importing data from has a date format that looks like this: 8/8/2019 5:58:23 PM. Unfortunately there is no way to change this format with other software and it is not recognized as a ...
0
votes
1answer
13 views

Given the week number, how to find the start date of that particular week?

Given the week number, how to find the start date of that particular week using a Formula Field?
1
vote
0answers
104 views

lightning input type = date, max attribute behaviour not similar in production and lower enviornment

I used max attribute of lightning input type date to disable the future dates in date picker. It was working in lower environments, but not working in production. In Lower Environments: It shows the ...
0
votes
1answer
50 views

Call a toast event in the Lightning Web Component date selector

Hi I have req where user select the date after the maximum date then i need to show the error toast message in saledforce LWC , can anyone help me out for the req. Below is the code let today = new ...
0
votes
1answer
19 views

add Datetime values inside IN query clause in a different context

I am trying to create a query dynamically which contains the Date and Datetime values with IN clause with WHERE For example, SELECT Id FROM Opportunity WHERE Program__c IN ('Online','On Campus') AND ...
0
votes
0answers
51 views

System.now() gives different value than expected?

For example if DateTime is : DateTime dt= Datetime.newInstance(2020,07,12,18,30,0); //using System.now() for dt DateTime.newInstanceGmt(dt.date().addDays(-5),Time.newInstance(00,00,01,00)) ;// should ...
0
votes
1answer
54 views

How to put filter in report for dynamic last month?

I am trying to filter out records in my salesforce report like i just want to see last month records (Created Date). See below what i have done so far, Date filter on Created Date > CUSTOM > 02-...
0
votes
0answers
183 views

Reset invalid value in lightning-input date to a blank value on click of a button

I have a lightning-input of type date. When I enter an invalid value in this field, there is a validation displayed 'Your entry does not match the allowed format MMM d, yyyy.' I want to clear this ...
2
votes
1answer
210 views

Dates appearing one day before the actual date

I am displaying a Lead list using a datatable inside a aura:component. This is the table i am displaying: I am developing this app from India. And, when the client opens the same app from USA, this ...
0
votes
1answer
23 views

Format String Visualforce Component in a Custom Visualforce Template

I am struggling with something I think should not be difficult but I am not able to figure out, my date field display as the below screenshot. My aim is to remove from the template the characters 00:...
0
votes
1answer
41 views

How to dynamically change the start time in the query body of REST API

I am doing a REST API call using POST method with [SSJS]. In the body of the API i am sending the following parameters. var start= { "activityTypes": [ "Wait" ], "start": "2020-...
0
votes
1answer
340 views

How to convert date to yyyy-mm-dd format using ssjs without timestamp

I am trying to convert the date to YYYY-MM-DD format using SSJS. But not able to do that. Getting NAN. var day = new Date(); var prevDate = new Date(); yesDate.setDate(day.getDate()-1); var test = (...
0
votes
1answer
143 views

How to use long date format in LWC

So I've been trying to understand the use of dateTime.longDateFormat in the documentation located here: [https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_i18n][1]...
0
votes
1answer
39 views

How to identify the % of time between two dates + how to find records between two dates using SQL [closed]

Relating to my question related to finding a date X% between two dates using SQL, I'm having a challenge resolving two other similar things: How to identify the % of time between two dates. Here's ...
0
votes
0answers
29 views

I need an “always up to date” ARR value in my accounts, based on opportunity values and dates

Hello Salesforce people, I have something I am trying to do in Salesforce, and I am coming up on a lot of limitations within the platform, and I wanted to ask the best way to do what I am trying to ...
-1
votes
1answer
22 views

Date format to MM.DD.YYYY

I'm trying to convert my datetime value into MM.DD.YYYY format Tried the following, 1. datetime dt = system.today(); string f = DateTime.newInstance( dt.year(), dt.month(), dt.day() )....
0
votes
1answer
19 views

Control going inside 'If' block even when it should not (only for 1 value)

I am trying to count the number of weekdays (Monday - Friday) by taking the number of days since 01-07-1900 (7th January, 1900), for a given date, and checking the modulus by 7. For modulus values 0 - ...
1
vote
1answer
61 views

Apex Date to string

I'm trying to display the Start date Concatenated with the End Date. To achieve this I've converted my date field to string and concatenating the string value. It works fine but in both start date ...
0
votes
1answer
31 views

Why does dateGmt() function contains a Time quotient at all?

Long startTime = 1112222220; Date startDate = DateTime.newInstance(Long.valueOf(startTime)).dateGmt(); system.debug('startDate: '+startDate); String qry = 'Select Id, Subject from Task where ...
0
votes
1answer
49 views

THIS_QUARTER is breaking SOQL query

I have a very bizarre issue with a batch job that is using the following query as a scope to generate new records Select id, Management_Fee__c, Payment_Schedule_Comments__c, ...
2
votes
2answers
205 views

AMPScript displaying wrong Date inside Journey that is triggered by automation - Reason?

The Problem A wrong date gets calculated by AMPScript GetSendDate with SystemDateToLocalDate inside a journey that is triggered by automations. Our SendLog DataExtensions has senddates displayed in ...
0
votes
1answer
246 views

ValidationError (Invalid Date) when importing a CSV to a Data Extension with a Date type field

I have extracted the _open Data View from an old instance and tried to import the 139K CSV records into a Data Extension in the new instance. However, I got a problem with the "EventDate" field when ...

1
2 3 4 5
12