Questions tagged [datetime]
A value that indicates a particular day and time, such as a timestamp.
680
questions
0
votes
1
answer
25
views
Lightning input type="datetime" not auto-populating values prior to 9am local time
I have a lightning component which has a datetime field, the value of which is auto-initialized with the component's helper.js. The default initialized value is supposed to be today's date and the ...
0
votes
0
answers
47
views
Apex class to return date/time in user time zone
I have a flow that calculates a datetime to restart a paused action. The problem is that the date is calculated and stored in GMT so the flow restarts at the wrong time. I need to to "wake-up&...
-1
votes
0
answers
22
views
How to parse a datetime value to int in a formula
We have a formula that calculates if a worker has arrived at his job and if he arrives late, indicate the time it took. The problem is that if the worker arrives late, the formula, instead of ...
0
votes
1
answer
62
views
Invalid date/time issue in Apex Code
I am working on a REST API integration class and it is passing a field called effectiveDate as part of the response. However, the data in the field is not consistent. Sometimes, it is passing the ...
0
votes
0
answers
56
views
Compare DateTime Fields in a Flow
I'm helping our Events team with a new flow that we're building. Within the flow, we're attempting to compare two DateTime fields with one another in order to execute actions based on the difference ...
0
votes
1
answer
53
views
SSJS date time filter for previous day
I'm having a problem in pulling in only the records with a ModifiedDate from the previous 24 hours from this SSJS filter when trying to access ListSubscribers object. I can use it to find a specific ...
0
votes
1
answer
38
views
DateTime gets converted in Salesforce from Postman
I'm receiving a datetime string as a response in postman from a service. but when I'm converting the string value to date time. The value is getting converted to date time as expected but it is ...
-1
votes
1
answer
66
views
Compare 2 datetime in Apex batch class
I have below query where i need to compare datetime custom field with system.now.
Currently my timezone is australia/sydney,which i need to consider,
I tried many combinations but getting Invalid ...
1
vote
1
answer
35
views
Trigger on difference between 2 date fields - not working
I'm a beginner in APEX and I'm trying to develop a trigger on Service Appointment that will auto populate the Work Duration field with the difference between the Schedule End date and Schedule Start ...
0
votes
0
answers
9
views
How to create journey exit timestamp in SQL Query [duplicate]
I would like to write a query that populates an "exit_journey_date" field for a data extension in Marketing Cloud.
I would like this query to run via Automation Studio, so that even though ...
-2
votes
1
answer
142
views
Formula: How to convert 24 hour time format to 12 hour time format [closed]
I have a date/time field Due_Date__c which I am using as a default value in an email quick action body. The return type of this formula is Text.
Here is the Due_Date__c field output: 2022-03-24 16:00:...
0
votes
2
answers
97
views
Convert a datetime to date in SFMC
I have an issue converting a date/time to a string format date. Indeed, I would like to change the following date format : 'mardi 15 mars 2022 4:24 PM' to this format '15/03/2022' without the timedate....
0
votes
0
answers
35
views
Pass a Date to a LWC, convert it, and submit it back to Salesforce
In this example the Start Date is update via the UI of a LWC.
End Date is not displayed in the UI
How do we get the End Date updated so the duration stays the same
Ultimately we seems to be struggling ...
0
votes
0
answers
38
views
Passing Time from LWC to flow and saving it to record
I am trying to pass Datetime value (in string) from my LWC (LWC is using a custom tag that allows me to have a 24-hour datetime field) to Flow.
In the flow it says the value as "2022-02-25 11:30:...
-3
votes
1
answer
38
views
Date formatting not working in Apex
I am trying to convert the date in a date field to different time zones using format method. But it is not getting converted. Below is the sample code.
Account acc = [select id, custom_date__c from ...
0
votes
3
answers
79
views
Date.parse not working for different locales
We have a Custom label that stores the value of a particular date like 11/19/2022 (mm/dd/yyyy)
This label is being used in several places in the code. And we are comparing another date with this date ...
0
votes
0
answers
26
views
Time Zone Issue - How to properly auto populate a date/time field [duplicate]
I have created a custom action that sets a date/time field to "NOW()" when the user hits save.
The user is in PST time zone.
The user hits save, the date/time field is updated to 1:30PM for ...
-1
votes
3
answers
39
views
Want to differentiate between two Date/Time fields without involvement of second
I have one scenario where I have to display cases in report whose lastmodifieddate is greater than closeddate
So everything is working fine but there is one issue
I have a case and I closed it. In my ...
0
votes
1
answer
30
views
Validation Rule date can only be changed to date in the same month BUT not changed if the month has already passed
The validation rule I have right now stops reps from changing the date if the meeting has been completed, indicated by a checkbox.
AND(
Meeting_Conducted__c = TRUE,
ISCHANGED( Meeting_Date__c ))
But ...
0
votes
0
answers
41
views
Bulk api query - querying last 5 mins
I have a requirement to query through bulk api job to fetch records last modified in 5 mins . While Querying I need to utilise lastmodifieddate field of the record .
Note : I can not create another ...
0
votes
0
answers
25
views
Derive formula for timezone on a datetime value
Is it possible to create a text formula that can derive the datetime for a specific timezone? For example, if you have an activity record with a due date that you want to send a sms text to the ...
1
vote
2
answers
58
views
How do I convert this paypal date format to a valid salesforce date?
Paypal is sending dates to my Rest service in this format 09:30:12 Jan 02, 2022 PST
If I use the DateTime.valueOf() function to translate the value to a DateTime field, it fails with an invalid date/...
9
votes
1
answer
189
views
How to check a large app for ICU update compatibility
A change in the interpretation of Date/Time strings (which originates from Java under the hood) will be enforced in all Salesforce orgs in mid-January 2022. (Find details here: https://help.salesforce....
-3
votes
1
answer
23
views
SOQL Help with DateTime attempting to populate package.xml
I am trying to Create a SOQL search to retrieve the FolderName, ReportType and DeveloperName from all reports ran from Jan 1, 2021. Here is my current search.
SELECT Name, FolderName, DeveloperName, ...
-1
votes
1
answer
147
views
Date/Timezone Issue in web service integration
I have an apex class making a callout to an external REST API and gets a response as shown below.
[
{
"externalGUID": "0d872ca4-45fc-45f9-97f7-0c4f8068ea79",
"...
2
votes
1
answer
263
views
Date in LWC - Year field shows extra values
When the user selects a year for Date, an alphanumeric value appears next to the year. Does anyone know how to remove this extra alphanumeric value? any help is greatly appreciated!
This is a custom ...
0
votes
1
answer
96
views
How do you work with the DateAdd function to add hours?
I'm new to AMPScript. I'm working with a Journey with SF Data Entry Source, specifically trying to send emails after someone registers for an event (which is logged in CRM).
I want to add six hours to ...
-1
votes
2
answers
161
views
Convert String to a DateTime Format (GMT) - Return type should be in Date time
I have a string with Date time format '10-12-2022 08:00 AM' I am trying to convert this string to DateTime format (GMT). 2022-10-12T12:00:00Z (Return Type should be DateTime, not the String)
Method 1:
...
1
vote
0
answers
43
views
How Can Dates From an Org and a User's Personal Machine be Reliably Compared to One Another (LWC)?
I have had some trouble comparing dates retrieved from an org and using them in a Lightning Web Component in order to tell whether or not a certain record has 'expired' in order to display said ...
0
votes
0
answers
40
views
Use DATEVALUE in formula on REFERENCED date/time field
I have the following formula on the case object:
TODAY () - DATEVALUE(Object2__r.LastModifiedDate)
But after I insert this field on the report nothing shows (I want show the day difference between ...
1
vote
1
answer
120
views
When calculating business hours between two dates, value is rounded to whole number
I have a formula field that calculated the difference in business hours between two dates from field MQL_Response__c and field MQL_Created__c. The hours are calculating correctly, but it rounds to a ...
0
votes
1
answer
120
views
Why do my apex code uses other time zone?
I'm running this code to get a DateTime and change the time of it to a preset one
DateTime dt = Datetime.newInstanceGMT(2021, 11, 8, 12, 0, 0);
Time t = Time.newInstance(8, 0, 0, 0);
System.debug('...
0
votes
2
answers
30
views
Get Date Time value in format 2021-11-03T22:45:00+05:30
I'm need to pass datetime value in 2021-11-03T22:45:00+05:30 format to external system. But I'm not sure how to get datetime in this format.
I tried multiple things, but it's not returning in this ...
0
votes
0
answers
20
views
Test works from Dev Console. Fails in automated nightly run
My query was failing with users with a Locale other than "en_US". So I switched the date format from UTC to GMT and it works well. Unfortunately while my tests work when I run them from Dev ...
0
votes
1
answer
41
views
Why isn't my DateTime field populating?
I am trying to push leads into Salesforce and I am passing in the following value...
Requested_Appointment_DateTime__c=2021-12-14T18:27:33Z
This format appears to match the YYYY-MM-DDTHH:MM:SSZ format ...
0
votes
1
answer
27
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
1
answer
29
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
1
answer
220
views
Converting Date/Time to Dates in reporting?
I have a report I'm running where one of the columns is Case CreatedDate, which defaults to a DateTime format like 9/10/2021, 11:44 AM.
Is there a way to apply formatting to this so it could show in ...
0
votes
1
answer
188
views
Why does this DateTime fail to parse without a comma?
One of my tests creates a DateTime object like this:
DateTime.parse('2/19/2024 4:30 PM')
In a scratch org, this throws an exception: System.TypeException: Invalid date/time: 2/19/2024 4:30 PM. I see ...
0
votes
1
answer
189
views
On validation, how to compare two Date/Time fields?
I have two Date/Time fields that need to compare, ON my validation Check-Out time must be greater than check-in time.
How to compare them in the validation rule?
CheckIn_Time (Date/Time)
CheckOut_Time ...
1
vote
1
answer
141
views
Converting date/time field to readable text with daylight savings
I think a formula is possible for this but I am new to SF so stitching it all together is challenging.
I am trying to convert a date/time field to a readable text field so that I can use it in email ...
2
votes
1
answer
161
views
Import Luxon into LWC
I am trying to use Luxon in a LWC.
I believe I am messing up the syntax of the decomposition of DateTime from the library.
Following the documentation: https://developer.salesforce.com/docs/component-...
0
votes
1
answer
57
views
Getting the value on formula NOW() in Apex
I have a Process Builder where a field type Double is populated with the following value.
NOW() - [Case].CreatedDate
When this action is triggered after around 1 min of creating the Case the value of ...
0
votes
1
answer
44
views
Update CreatedDate field value of a list to be displayed in UI
I am trying to update the value of a field inside of a list to be returned to the LWC component. I don't want the update to happen on the database, but just on the UI.
As datetime values are stored in ...
0
votes
0
answers
103
views
Add Business Hours to date/time field using process builder formula
When a email-to-case is submitted Planned Completion Date field should auto populate to 3 days(or 72 hours) in the future. It should not take into account weekends, so something submitted Friday would ...
-1
votes
2
answers
541
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
1
answer
70
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);
...
0
votes
1
answer
69
views
How to insert Event with same time/timezone as it appears on Visualforce page
I have a public Visualforce page on Salesforce Sites with the form below.
The site Guest user expects the event to be created in their time zone (EST) for the same date and time as it appears on the ...
3
votes
0
answers
290
views
`lightning-formatted-date-time` 24-hour time bug
How do I display a time in 24-hour format? The documentation suggests hour12="false" should do it, but this isn't working, as detailed below.
foo.js:
import { LightningElement } from "...
0
votes
0
answers
207
views
FSL Service Appointment Date/Time fields are displaying in Current User Timezone instead of associated Service Territory timezone
Problem:
FSL Service Appointment Date/Time fields are displaying in Current User Timezone instead of associated Service Territory timezone.
Due Date,
Earliest Start Permitted,
Scheduled Start,
...