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
1 answer
194 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 ...
Sfdcprgmr's user avatar
  • 357
1 vote
0 answers
1k 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"> ...
user91337's user avatar
0 votes
1 answer
2k 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) ...
TheAdmin's user avatar
  • 335
0 votes
1 answer
458 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 ...
King Dev's user avatar
  • 444
0 votes
1 answer
134 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 = ...
gs650x's user avatar
  • 2,519
1 vote
1 answer
776 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 ...
gs650x's user avatar
  • 2,519
2 votes
1 answer
220 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 = ...
Anne-Sophie's user avatar
0 votes
1 answer
146 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 ...
M Wemett's user avatar
0 votes
2 answers
710 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 ...
indrasen neelam's user avatar
0 votes
2 answers
778 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 ...
Hari Ha's user avatar
  • 107
1 vote
1 answer
479 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 ...
Hari Ha's user avatar
  • 107
0 votes
1 answer
799 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(), ...
Eric's user avatar
  • 73
0 votes
1 answer
2k 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 ...
Akshay Vasu's user avatar
0 votes
1 answer
93 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 ...
Hari Ha's user avatar
  • 107
0 votes
1 answer
1k 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), ...
Thomas's user avatar
  • 2,284
0 votes
1 answer
411 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(...
MirniyPirojok's user avatar
1 vote
2 answers
216 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 ...
starboy The's user avatar
0 votes
1 answer
202 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
Akash's user avatar
  • 327
5 votes
2 answers
676 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 ...
Chirag Mehta's user avatar
  • 1,271
0 votes
1 answer
395 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 ...
highbranch's user avatar
1 vote
2 answers
320 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 ...
Pearson's user avatar
  • 13
0 votes
1 answer
35 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 ...
Akshay Vasu's user avatar
3 votes
1 answer
2k 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 ...
Andrii Pytel's user avatar
0 votes
1 answer
390 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 ...
Resaani's user avatar
0 votes
0 answers
64 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 ...
tanurang's user avatar
0 votes
1 answer
31 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 ...
Nauman Husnani's user avatar
0 votes
1 answer
2k 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 = ...
SFDC Dev's user avatar
1 vote
1 answer
147 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 ...
Eduardo's user avatar
  • 27
1 vote
1 answer
254 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&...
Will's user avatar
  • 184
0 votes
1 answer
505 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 ...
Mano's user avatar
  • 1
2 votes
1 answer
38 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 ...
Brian Kessler's user avatar
2 votes
1 answer
748 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....
Jayesh Babu's user avatar
2 votes
2 answers
333 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 ...
Jayesh Babu's user avatar
1 vote
2 answers
1k 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 ...
YXY's user avatar
  • 130
1 vote
1 answer
4k 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 ...
Emmanuel_M's user avatar
0 votes
2 answers
6k 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 ...
Andrew Sean Baldwin's user avatar
0 votes
1 answer
2k 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:...
Raj's user avatar
  • 1
1 vote
2 answers
2k 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(...
Meenu rosy's user avatar
0 votes
1 answer
5k 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 ...
Sfdcprgmr's user avatar
  • 357
0 votes
1 answer
3k 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....
Luke Higgins's user avatar
0 votes
1 answer
806 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 ...
Luke Higgins's user avatar
0 votes
1 answer
741 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?
Shumon Saha's user avatar
  • 4,592
1 vote
0 answers
418 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 ...
Pankaj Andhale's user avatar
0 votes
1 answer
183 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 ...
Tisca's user avatar
  • 3
0 votes
1 answer
49 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 ...
Hunt's user avatar
  • 215
0 votes
0 answers
90 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 ...
Isha's user avatar
  • 163
0 votes
0 answers
851 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 ...
Krish's user avatar
  • 1
2 votes
1 answer
2k 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 ...
Jayesh Babu's user avatar
0 votes
1 answer
91 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:...
l13's user avatar
  • 17
0 votes
1 answer
216 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-...
Harry's user avatar
  • 11

1 2
3
4 5
14