Questions tagged [datetime]

A value that indicates a particular day and time, such as a timestamp.

Filter by
Sorted by
Tagged with
1
vote
1answer
42 views

SQL to change part of a datetime to a specific time of that day

I have a use case where I want to use the "Wait by Attribute" function in Journey Builder to wait until a specific time of day to send and I need to figure out the SQL to change just the ...
0
votes
0answers
24 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'. ...
0
votes
1answer
31 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
15 views

Query Studio - Could not convert date and/or time from string data type

On one data extension, I have a DateIn field modeled as text. The value can be in one of the two formats like: 2015-06-23 16:12:04.703 8/6/2018 11:46:59 AM When I cast the field to date and use it ...
0
votes
1answer
33 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
49 views

How to get Data extension records between Start date time and End date time using AMP script?

I want to retrieve based on modifieddate(updated) field records count between start date time and end date time in my data extension. How to include startdatetime and enddatetime in lookuprows for ...
0
votes
2answers
42 views

How to retrieve records created today in Data Extension using AMP script

In my data extension dynamically records will created every day. Here i want know how many records will created every day. I am unable to fetch the today date values in lookuprows for equal to ...
0
votes
1answer
34 views

Number Formula - Two Date/Time Field Difference Within Business Hours

I have a formula field (FirstCallDif__c) that shows in minutes the difference between two fields: (FirstCall__c - CreatedDate) *24*60 This gives us the minutes however some leads do come in at say ...
4
votes
2answers
271 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
16 views

Correct Datatype for new field - list of timestamps

I'm just doing this using the Salesforce Lightning GUI, not doing it programmatically. I am creating a new field for a Salesforce object. This field will hold multiple datetime stamps. When an event ...
0
votes
1answer
31 views

Daylight Savings Time (DST) and Last Modified Date (or Created Date) in Apex

I have to create a dynamically changing string for a Task custom field . The Apex code uses Last Modified Date within the EST time zone. My question is: Doesn't Salesforce handle the Daylight Savings ...
0
votes
0answers
36 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
37 views

Getting the date for next month in apex

I need to write a logic to update a field with a date from next month. For example, today's date is 28/10/2020 11:00:00 AM, the field should be updated with 28/11/2020 11:00:00 AM. So just the value ...
0
votes
1answer
59 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
1answer
28 views

Sorting of DateTime field in Angular JS [closed]

I have a requirement where in I need to sort records in the descending order of DateTime type field in angular JS, used in vlocity template. If I am trying to sort just by Date type field, then the ...
1
vote
1answer
92 views

Date/Time Conversion from YYYY-MM-DDTHH:MM:SS

I have a Date/Time value from a JSON response in the form of 2020-10-01T15:22:20 that I am trying to convert to something that looks like 10-01-20 15:22 in Apex. Any help is greatly appreciated.
0
votes
1answer
25 views

How to have a fixed time populated in a date/time formula field?

I have to create a date/time formula field, whose date value will come from a date/time field. However, I want the time to be always 5:00 am. How do I achieve that?
0
votes
0answers
38 views

manipulating DateTime on a field

I have been receiving datetime eventtime in Local time zone say(2020-10-04T23:02:20).I have stored starttime as 22:00 and endtime as 5:00(which denotes 5 AM) in a custom setting. I need to subtract ...
0
votes
2answers
52 views

How to convert datetime in GMT when input format contains AM/PM?

From UI I am getting this input: Date : 2020-09-25 Time : 12:15 AM Now when I try to save this to DB it saves as 2020-09-24T17:15:00.000Z And when it gets shown in UI again after refresh the time ...
1
vote
2answers
82 views

In Apex, how can I format Datetime for Europe/Berlin without assuming the input value is GMT?

I currently have the following function: public String formatForGermany(Datetime targetTime) { return this.format(targetTime, 'Europe/Berlin'); } private String format(Datetime targetTime, String ...
0
votes
0answers
23 views

Use the date time in the timezone of the record owner on custom object

I have a custom object My_Object__c. I want to build a Formula Checkbox field where the checkbox is checked if the CreatedDate local time in the Timezone of the Owner was more than 6 pm. E.g. we have ...
0
votes
1answer
31 views

CDT time conversion to salesforce dateime field format

I have been stuck in a problem actually i am trying to covert a datetime format in salesforce date time field format The datetime format which i am getting is 2020-09-13 10:37 CDT I tried removing CDT ...
0
votes
1answer
93 views

Add UTC offset to a Datetime field

I'm having a problem to add a UTC offset to a datetime value. For example I have the following value 2019-01-18T00:00:00.000+0000 but I must put this value in another field adding the UTC offset (-...
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 ...
1
vote
1answer
266 views

Salesforce displaying Time custom field in GMT instead of User's timezone

We are facing an issue with BST and GMT time zone. We have a community portal and the org timezone and all the Users timezone are set as BST. Part of our functionality is to book an event and we ...
0
votes
0answers
39 views

How to convert the Current User Time from String to DateTime data type? [duplicate]

I have to populate the Current User Time-Zone DateTime in a DateTime field. I am trying this : String str = datetime.now().format(); DateTime d = Datetime.valueOf(datetime.now().format()); DateTime ...
0
votes
1answer
74 views

Rounding Issue on formula field calculating business hours between two dates

I have the following formula and even though the formula field is set as a number type and has 2 decimals set, the below formula is still rounding up to a whole hour. I can not figure out how to get ...
2
votes
1answer
66 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....
1
vote
2answers
121 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
140 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 ...
1
vote
2answers
161 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
61 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
174 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 ...
0
votes
1answer
53 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
249 views

Refresh button with time in lwc?

I have kept the refresh button my requirement is when I click the refresh button it needs to show the time for each time refreshing the page or record there is any resolved solution? Like this, I need ...
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
412 views

How to convert 08:00:00.000Z to 08:00 AM and 18:00:00.000Z to 06:00 PM in salesforce apex?

I'm getting the data "StartTime=08:00:00.000Z, EndTime=18:00:00.000Z" and while displaying in page, it should be "08:00 AM , 06:00 PM". How this can do using Apex controller?
2
votes
1answer
38 views

Deserialize Datetime from Custom Settings in Lightning Component

Is there a helper utility for Lightning components to convert values from Datetime objects into a deserialized value? I have two Datetime values in Custom Settings... My_Start_Date__c My_End_Date__c ...
0
votes
1answer
15 views

Invalid Bind Expression type of Date for column of type String

I am working on an API end point that returns data and allows user to pass in a 'createdDateStart' to filter records on a Formula field called Formatted_Created_Date__C. The contents of the formula ...
0
votes
1answer
404 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
53 views

Datetime link to insert current datetime with standard apex:inputfield not working

I have a VF page of version 47 with lightningStylesheets as true and included apex:slds tag. I'am trying to use apex:inputfield as below but link to insert current datetime is not working. <apex:...
3
votes
1answer
502 views

SOQL where clause for date time fields - user timezone or UTC?

We have a scenario where we need to compare a date time field Last_Response_Date__c against today function in SOQL List<Contact> lstContactWithSamePhoneNo1 = [SELECT ...
0
votes
1answer
83 views

Converting Datetime to Epoch

How to Convert Current Timestamp with millisecond to Epco. I have Json array of Object, that object does not have an unique value So i was trying to get the Current Timestamp with Milliseconds and ...
-1
votes
1answer
74 views

How to Convert ISO String in DateTime [closed]

String date = '2020-05-15T08:48:17.000+0000' I want to convert String which is in ISO format to DateTime in apex
0
votes
1answer
34 views

How to find a date X% between two dates using SQL [closed]

I need to find what the date is X% between two date fields. The use case is I want to send an email to someone who is 70% of the way through their tenancy. For example, Move-in date = 01/01/20 Move-...
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 ...
1
vote
1answer
246 views

passing a variable in SOQL select statement with python and simple-salesforce

I am trying to pass a variable into SOQL statement, I am using simple_salesforce library. I only need to grab the data when CreateDate of the Opportunity is > than yesterday, yesterday's date is saved ...
0
votes
0answers
29 views

Import English (UK) dates into Marketing Cloud

I am trying to import a CSV with a bunch of customer information into Marketing Cloud. The import keeps failing due to Invalid Date: 7. I've been using English (United Kingdom) as the date format ...
0
votes
2answers
58 views

why this Datetime works like this?

I have 2 datetimes with fixed values: 2020-09-12T18:13:41Z <lightning:input aura:id="stst" type="datetime" name="input3" label="{!$Label.c.Start_Date_Time}" required="true" value="2020-09-12T18:...

1
2 3 4 5
13