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.

1
vote
1answer
14 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
30 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
37 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
37 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
19 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
38 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
45 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
27 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
34 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
29 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-...
0
votes
0answers
45 views

lightning:input type=“datetime-local” is adding the current user timezone value when mapping the datetime in datetime attribute

I have a custom calendar show below in picture. Using the calendar I need to book appointments for my user. When I click on the available slot I need fetch the date and time from the calendar and ...
3
votes
1answer
544 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
24 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
32 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
38 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
146 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
89 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
30 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
26 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
21 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
32 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
28 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
129 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
23 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
31 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
54 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
46 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
32 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
78 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
45 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
34 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
83 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
26 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
39 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
29 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
212 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 ...
0
votes
1answer
49 views

Convert string time to datetime with timezone

I have a requirement where I want to convert a String time "15:00" (pstTime String) in PST timezone to a string time "08:00"(gmtTime String) in GMT. The date is immaterial. The way I'm trying to ...
0
votes
3answers
124 views

Merge Date & Time field in to datetime field using formula field

We have to separate fields to pick appointment date & appointment time in Custom object. Now we have to filter out appointments between two dates (w/ time), so I need to compare appointment date &...
0
votes
1answer
52 views

DateTime Formatting in Visualforcepage (Comment Section)

I am now creating a comment section on my visualforce page and I don't know how to achieve this kind of datetime formatting. This is my code in Visualforce page. <div class="commentDate"> &...
0
votes
1answer
52 views

converting date format to sydney time

Im able to achieve getting date format to server time(LocalDateToSystemDate(@currentSystemTime)) or user time(now()) in ampscript. But i want this date format to be convert to sydney time how can we ...
1
vote
1answer
36 views

BusinessHours and scheduled dates

I am trying to create a payment schedule off of a input field DATE. If the date falls on a Weekend or on a Holiday then I want to move the payment date to the next open business day. I was using the ...
3
votes
1answer
52 views

Why Datetime and Date class don't have more parse options for various Datetime/Date string formats

From documentation: Date Class: parse(stringDate) Constructs a Date from a String. The format of the String depends on the local date format. Datetime Class parse(datetimeString) ...
1
vote
1answer
81 views

Using the wait activity by attribute for time values only

I have a data extension that has all our subscribers and a column with the most optimal hour of the day to send them an email. I want to reference this in my journeys and add this attribute in the ...
0
votes
0answers
52 views

Ampscript to change the date display from a data extension

I have a data extension where the date is displayed as 20/07/2018. I tried using the ampscript to change it to 20 July 2018 but no luck at all. this is my script. %%[ var @date ...
0
votes
1answer
74 views

Why DAY_ONLY(convertTimezone()) Query giving wrong results?

I need to display time retrieved from a dynamic SOQL and display at visualforce page using remoteaction. As we know code runs in system context and values in UTC time zone are retrieved. Is there ...
2
votes
1answer
106 views

Date.ValueOf(TimeStamp) Changes TIme of Original DateTime Field. I'm Confused Why?

I've noted very strange behaviour in some Apex code I'm running. If I use the Date.ValueOf() function on a datetime. If I then print out the DateTime afterwards the hour/minutes of it have changed to ...
2
votes
1answer
54 views

DateTime Vs. Date Flow To ProcessPlugin

I find this to be odd, not sure if this is a known issue or if it is something I just have to convert but I have a flow that calls a apex process plugin class. The flow takes a variable of type Date ...
2
votes
0answers
72 views

Moment JS but for Salesforce Apex

Are there any open source libraries similar to Moment JS but for Apex? Reference: Moment JS
1
vote
2answers
82 views

DateTime field isnot working SOQL Query

I have couple of Question on datetime fields. Question 1: How to pass current month beginning date time and ending datetime in Apex Here I setted"July" Month start datetime and end date time ...