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
48 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
31 views

Produce a date field but ONLY if its greater then a set date, if not produce a blank field

I have an giant if statement that is working. But what I need to add is another formula before or after that states if that date that is produced is greater then or equal to 4/5/2021 to just be a ...
0
votes
1answer
38 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
25 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 ...
0
votes
0answers
14 views

Change date format inside lwc

I have a date field in case object. I just want to change the date format to mm.dd.yyyy in UI. I am doing the below operation in the getter but it's throwing an error. JS: @wire(getRecord, { recordId:...
2
votes
1answer
43 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
23 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
27 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
33 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
22 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 ...
0
votes
0answers
68 views

Date comparison in the formulas in the Flow

I am trying to compare the created date of the record in the flow Formula resource to see if it falls between 1-31-2021 and 3-3-2021 and set another text variable as '02-February' otherwise 'n/a'. ...
1
vote
1answer
13 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
43 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
76 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
18 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
64 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
40 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
37 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
284 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
60 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
38 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
18 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
173 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
34 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
38 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
130 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
52 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
27 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
36 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
53 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
25 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
12 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
72 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
34 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
156 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
260 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
262 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
217 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
223 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
431 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
84 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
296 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
57 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
28 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
131 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
57 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 ...

1
2 3 4 5
12