Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [datetime]

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

0
votes
1answer
22 views

Date is Subtracting 1 day after converting to other format

For some reasons, the Date is subtracting one day whenever it is converted to other formats, I don't have any idea why this is happening. I am using .addDays(1) to temporarily solve the issue, but I ...
0
votes
1answer
20 views

System.QueryException: value of filter criterion for field 'CreatedDate' must be of type dateTime

Below my code, I want to pass date value as a parameter but I facing an error as below, message: System.QueryException: value of filter criterion for field 'CreatedDate' must be of type dateTime and ...
0
votes
1answer
10 views

How to convert UTC Datetime to Salesforce DateTime Object

I have the following date 2013-01-30T07:38:44.268Z and I need to convert it to a datetime object. can you explain how?
0
votes
0answers
17 views

Process Builder Date Time Formula Help Please

I'm build a Process Builder Criteria that needs to say: if X Field = Error && AT 3AM TODAY then Execute Action. I'm not sure how to do 3AM Today. Thanks
0
votes
0answers
13 views

What is wrong with my Date/time Process Builder Formula based on a Date field without weekends

I have a Task Process Builder based on Opportunity Stages. I am trying to create a formula for the date time due field based on a date field (Internal Deadline). I need the formula for the Date Time ...
0
votes
1answer
25 views

What is the behavior of date/time fields regarding daylight saving time?

A user located in São Paulo/Brasil is on the UTC-3 timezone. As I write this post it is actually UTC-2 because of daylight saving time. That means that records created today will have the value of ...
0
votes
0answers
23 views

Populate date fields on multiple records using a formula?

So we have a custom object called 'Sessions' (child). Sessions are automatically created via a trigger for a 'Course' (parent). Now depending on the value of the 'Level' field (on the Course) object, ...
0
votes
2answers
73 views

System.TypeException: Invalid date/time: 2019-01-03T00:26:01.711-02:00

Im trying to format this String into DateTime. String 2019-01-03T00:26:01.711-02:00 Code String data = '2019-01-03T00:26:01.711-02:00'; Datetime dt = DateTime.parse(data); Exception System....
2
votes
1answer
44 views

Format date time field to specific time with AMPscript in Marketing Cloud

I have a question; we are trying to send an appointment confirmation through Journey Builder. Now we are struggling to get the time right. It looks like there is added 1 and sometimes 2 minutes to the ...
0
votes
1answer
44 views

Datetime conversion from GMT to CST [duplicate]

Can someone please provide the code of converting the GMT timezone to CST. DateTime now = DateTime.now(); system.debug('>>>' + now); Long offset = DateTime.newInstance(now.date(), now.time())...
0
votes
2answers
22 views

datetime conversion to CDT

Can anyone please help me how to convert the given time into CST timezone. Input timezone will change dynamically, so i want to convert the given timzone into CST and then need to get the hour from ...
1
vote
1answer
46 views

DateTime values in Bulk Query results - difference between CSV and JSON formats

I'm running Bulk API queries in Python, using both the simple_salesforce and salesforce_bulk libraries. I've encountered a confusing result when querying DateTime fields. Given a simple_salesforce ...
0
votes
1answer
23 views

Hour of the requesting user's timezone

Is there any way to find the requesting hour of the user irrespective of the user zone specified in the user's timezone. Eg: I have a scenario like few users are requesting from India, where as some ...
0
votes
2answers
57 views

Convert String Date to Date in Apex

I am using an SOQL in a webservice that is querying the Contact object based on the BirthDate field. The webservice request has the date in the format of 'yyyy-MM-dd',i.e.,1962-01-29 as an example. I ...
1
vote
1answer
15 views

custom settings to set event reminder

I'm trying to put (-60) value in the reminder time. it works but it is hard coded. I want it from custom settings so admins could edit the numbers from the GUI. trigger setReminderEvent on Event (...
3
votes
2answers
35 views

Convert different Date Formats into Date based on User locale

I am getting different formats of date formats in date field from Json as a string. I should be able to convert any Date format into Date based on user locale.below are the example of formats. Ex: "...
0
votes
1answer
57 views

Calculate time difference between two date time fields

I have a process builder by which I am calculating the time difference between NOW() and another Case object date field. My formula goes like this Time_Spent__c = NOW() - Start_Time__c However ...
1
vote
0answers
51 views

Computed an invalid date, such as February 29th in Salesforce,

I have a workflow rule in place that updates ReminderDateTime when from another custom DateTime field which is a formula field on the same object. But eventually when i tried complete a task, i am ...
1
vote
1answer
54 views

Convert Date field's value into milliseconds

Could someone please help me with a formula to convert Date field's value into milliseconds. I need the millisecods to be calculated from 01st Jan 1970. Thanks in advance. Convert Date
0
votes
2answers
41 views

DateTime Convertions

I have a problem to convert String to DateTime and Insert it to a DateTime field in SF. I found out that this is work : String dateee = '2015/03/10 05:03:20'; DateTime date_time = DateTime....
0
votes
1answer
56 views

Date/Time AMPscript code in Cloud Page

I need formatting of date/time in this format: set @date1 = Format(Now(),"YYYY-MM-DDThh:mm:ssZ") Where as its not working and if I give like this - FormatDate(Now(),"YYYY-MM-DDThh:mm:ssZ"), only ...
0
votes
1answer
43 views

Wrong date when converting datetime value to date field

I am using the REST API for creating a new Task record, including an Activity Date in the format YYYY-MM-DDThh:mm:ssZ. My current timezone is UTC+1. When submitting a date in the first hour of the ...
1
vote
1answer
88 views

Salesforce datetime field adding user timezone to the field

I have two datetime field in custom object, to which I am inserting values programatically from my apex class. Fields from my custom object My apex code used to insert/update records in the custom ...
2
votes
1answer
42 views

Adding days and then business days to a datetime field

Here is what I am attempting to do. I have a date on a custom object Deal__c. The date is Asset Management Close Date (Asset_Mgmt_Close_Date__c). The sidecar__c object is created with a master-...
3
votes
1answer
586 views

Datetime.addDays method works unexpected with daylight saving time offset day

I have a small piece of code which is displaying the Day of the week which is part of a larger method. Date StartDate = Date.newInstance(2018, 11, 4); Datetime StartDateDt = Datetime.newinstance(...
0
votes
1answer
27 views

How do I grab records from today using ampscript?

I am trying to check what records in a data extension are from today. The data that is in the date field, 'localtime', looks like this: Thursday, November 01, 2018 10:07 PM Friday, November ...
-1
votes
1answer
35 views

workflow and time based workflow help

Is there a way to assign a timebased workflow for the following? I have 2 fields, reminder__c, and registration_date__c. If my reminder__c is blank for 14days or more after my registration_date__c, i ...
0
votes
1answer
66 views

Facing issue in Event while query with timezone conversion

I am trying to display today’s event ina vfpage like Salesforce today event component does, but my query is not resulting in the correct list based on user time zone when putting where clause to today....
3
votes
1answer
152 views

Can someone sanity check my DateTime math? (Related: Can someone explain the “long” data type like I'm 5?)

Attempting to implement a formula similar to that outlined here, namely where check a box if NOW() - CreatedDate is more than a couple seconds. I originally had ((NOW()-CreatedDate)*10000) > 1, ...
2
votes
1answer
365 views

Difference in minutes between two datetime fields

I need to calculate the difference in minutes between two datetime fields inside a formula. The following works if the dates are different (date2__c-date1__c)*24*60 But if its the same date then ...
1
vote
3answers
44 views

Data Loader Error Date/Time fields Failed to parse date

All of my records are failing to insert for the same error. I do not see an issue with the format itself. I also tried using European format with no luck
0
votes
3answers
33 views

Formula field value for old records and another value for new ones

I have formula fields which calculates the net value and total value for sales order object, I want to change these formula fields values but not affect the old value for sales order which is packed, ...
0
votes
1answer
28 views

How to save Date and Time in Subscriber Attribut using AMPscript

im trying to store the date and time when a subscriber hit the confirm button or visit the confirmation cloud page. Currently I have built 2 Cloud Pages, 1x for Preference Center and 1x for ...
1
vote
1answer
49 views

Business Hours difference calculation during BST

Hello I need help understanding how business hours difference is calculated with the Apex class. The documentation is rather poor and doesn't explain the input parameters assumptions. I found one post ...
0
votes
1answer
55 views

Consume Date/time Iso 8601 timestamp in salesforce Datetime field

Im trying to parse an ISO 8601 timestamp value consumed in a JSON data format to a DateTime field value in salesforce. Class 1: if ((fieldStatus == ‘normal’) || (fieldStatus == ‘overwritten’)) { try ...
2
votes
2answers
274 views

Parse date time string to Apex DateTime

How do I parse 2018-10-01T00:00:00Z Into an instance of DateTime I've tried: DateTime.valueOfGmt('2018-10-01T00:00:00Z'); DateTime.parse('2018-10-01T00:00:00Z'); DateTime.valueOf('2018-10-01T00:...
0
votes
2answers
32 views

How do I get a formula with a Date/Time data type?

The formula expression is invalid: Formula result is data type (Date), incompatible with expected data type (Date/Time). I tried TODAY()
0
votes
2answers
75 views

Date/time field cant be selected in scheduled action in Process Builder

I have a custom object with a custom date/time formula field. When I try to select this field in the processbuilder the field does not show up. Am I missing something? See image
0
votes
1answer
72 views

Output hours only with DateADD function

I have a requirement to output only time from date/time field in a SalesForce campaign for an email I am working on. I had to split up the date/time in order to format as desired. SET @Delivery = [...
0
votes
2answers
64 views

Specific timezone on visualforce page

page <apex:variable value="{!activity}" var="act"> <apex:outputText value="{0,date,h:mm a}"> <apex:param value="{!act.Date__c}" /> </apex:outputText> controller....
0
votes
1answer
40 views

Get Date/Time in GMT for selected date

user selects the date some thing like this c.Date_Time_Scheduled_Service_Call__c=2018-09-28 03:40:00. By default salesforce stores date time in GMT. I would like to get that stored dattime GMT in apex....
-1
votes
1answer
227 views

System.TypeException: Invalid date/time: 2018-09-18T16:57:37Z

I'm getting Invalid date/time: 2018-09-18T16:57:37Z in the developer console. please help me with this DateTime dt = Datetime.now().addMinutes(-10); String formatedDt = dt.formatGMT('yyyy-MM-dd\...
0
votes
1answer
109 views

Datetime in WHERE clause

I am facing issue with Datetime column in WHERE clause. Below two queries are giving different counts. SELECT COUNT(CallTime_c) FROM SF...TableName WHERE CallDateTime > '09-13-2018 09:01:00' and ...
0
votes
1answer
37 views

How to use different System.assertEquals() in two separate methods?

I have the following test methods. Test method #1: public static List<Account> testAccountsMethod1() { List<Account> accounts = new List<Account>(); for (Account ...
0
votes
1answer
59 views

How to use System.assertEquals() for DateTime?

I have the following test class: public static List<Account> testAccounts(Integer numberOfAccounts) { List<Account> accounts = new List<Account>(); for (Integer i = ...
0
votes
2answers
131 views

How to pass Date dynamically to newInstance method of Datetime

i want to pass date into newInstance method of datetime class then i will get date of week.when i have given static date it's working fine but when i try to pass dynamically i am getting error please ...
0
votes
1answer
42 views

Difference in Case Created Date in UI and System Backend

created date on case UI is displaying 5/9/2018 date but in backend created date is showing value 6/9/2018 When I am querying through developer console. I have one workflow rule to calculate Target ...
0
votes
1answer
45 views

How to know the completed time stamp of my scheduled Queueable class

I'm looking at What's the difference between AsyncApexJob and CronTrigger? Currently I have a Schedule class, and queueable class(which fires future methods). Below is the hierarchy: Schedule class ...
3
votes
2answers
79 views

Is it possible to JSON.deserializeUntyped directly to DateTime without information about field is DateTime?

I wonder if it is possible to JSON.deserializeUntyped directly to DateTime type. How can I check if deserialized Object in Map has type of DateTime? I am curious is it possible, because Object in ...
3
votes
2answers
272 views

Lightning Input datetime prevent value issue

I am using a lightning:input to get a date/time value in the users Locale. If the user picks a date that is beyond today I need to prevent that value from being entered. I am able to catch this ...