Stack Exchange Network

Stack Exchange network consists of 175 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
votes
1answer
27 views

How to compare datetime field in the format 2019-01-02 04:18:00

I have a Datetime field in Salesforce called Checkin_Date__c. I have got a list of records, then trying to compare the checkin datetime field in all the records, and want to store the recent one. But ...
1
vote
2answers
34 views

What happens if I don't provide Time in Date/Time field

I am creating a Rest API. I have one DateTime field(one of the field for POST request). Wondering what happens if someone calls the API, makes the POST request and fills out just the Date part of the ...
0
votes
1answer
30 views

ISO8601 Z conversion to local date (Pacific) within SQL

I can't figure out how to take this ISO8601 date and convert it to local time (PDT). I've tried a couple things: convert(datetime, updated_at_text, yyyy-mm-ddThh:mi:ss.mmmZ) as LastUpdated, convert(...
1
vote
2answers
54 views

Formatting Datetime.now()

I need to format my Datetime.now() to be accepted for a SOAP request. I can't seem to find a way to format it online. Can anyone advise? I need it to look like: 2019-05-02T21:20:29.999Z Currently I ...
7
votes
1answer
86 views

Set collection doesn't always enforce uniqueness with the Date datatype? Does the following example seem correct?

Consider the following unit test: @istest public static void datetests2() { Set<Date> dts = new Set<Date>(); dts.add(DateTime.now().Date()); dts.add(DateTime.now().addHours(1)....
0
votes
1answer
40 views

Business Hours calculation is incorrect/ not consistent for certain dates

My use case is to calculate the deadline to respond on the Case. Rule is to add 10 business days from the complaint received date. Defined the business hours: Logic 1 Date initialDate = ...
1
vote
0answers
24 views

Convert time to recipient's local time on Email marketing

I'm building an email invite to join our webinar on Marketing cloud. My recipients are based in different time zones. How can I convert my webinar time to their local time zones? I'm using BeePro to ...
0
votes
2answers
23 views

I want the result of my query should be without the time and only date will be shown in result [closed]

Select Id, CreatedDate From Opportunity Where DAY_ONLY(CreatedDate) this the query I used but result is still with time
0
votes
1answer
29 views

Not getting the right time in apex

DateTime.now() return time stamp which is 10 hours more than the current time, I am currently using the Hawaii standard time please find below the snippet now current time is 6:11 am but if I use ...
1
vote
1answer
24 views

Compare DateTime in Apex

I have created 2 dateTime Instances as below to compare DateTime.now() if it is greater than 8 pm and less than 7:59 am then I want to execute some code but it is difficult to compare dateTime as the ...
0
votes
0answers
19 views

ISO 8601 date/time parsing incorrectly from API input

I have a REST API pushing data into a Marketing Cloud data extension and SFMC appears to be transforming it to the system date/time vs the original input from the API. eg. I have a record with an ...
0
votes
1answer
48 views

DateTime field value in Text formula

I have a DateTime field which shows proper time on UI, I know behind the scene it is GMT format. However I would like to populate same format as it displays on UI in a text field along with some text.
0
votes
1answer
144 views

Convert 24 hours date time to 12 hours date time format

I need to convert and assign 24 hours date time value to custom date time field. For Example, in my apex code I am getting the date time value as ‘2019-03-12 14:38:00’, I need to convert and assign ...
1
vote
1answer
18 views

Get the Hour from a date time field with the current time zone in a formula field

I create a custom field to display the hour and the minute of a date time field. The format I need is HH:MM For now, I get the hour in GMT but it is wrong because I am in France and the time zone ...
1
vote
0answers
18 views

How to get records created between timeframe in a report

I need to create a report of all the records between 7am to 5pm CST/CDT everyday. How can I achieve this? The solution I tried - Created a formula field which extracts Hours from created date (...
0
votes
1answer
83 views

SOQL DateTime Greater than Date

For the life of me I cannot figure out how to query tasks greater than a given DateTime. I have a field, inqDateTime, that I need to pull tasks greater than that date. I have tried to convert the ...
0
votes
1answer
25 views

How to Parse date time String to DateTime using Apex

Given this string value: String dateTimeString = '20/12/18 16:39:51'; // or '31/10/18 09:35:16' How would I parse it to a DateTime? I've tried this: DateTime dt = DateTime.parse(dateTimeString); ...
0
votes
2answers
42 views

Date-time stamp in sends & opens data view in marketing cloud is not in sync with local time

I'm using salesforce marketing cloud for sending emailers. Date time settings in my account are set as per IST (Indian standard time), GMT + 5:30. Though when I fetch data from "Sends" & "Opens" ...
1
vote
1answer
21 views

Getting the non-converted time of a DateTime

Hi I'm having an issue with getting the non-localized time of a DateTime's time value. Here's some of the execute anonymous I'm having trouble with. DateTime aDate = DateTime.newInstance(System....
2
votes
1answer
98 views

Adding days to the Date portion of DateTime throws off the Time portion

So I'm having an issue in Apex with the Date's addDays function. It seems that adding more than a certain amount of days throws off the time by one hour. It all seems so arbitrary so I'm wondering ...
2
votes
1answer
32 views

In process builder, how do I write a formula to set a relative day but a specific time?

In this example, let's say a new account is created and we want to have a kickoff lunch with that new account. I'm setting up my logic in process builder using a Start Date Time set to... ...
0
votes
1answer
38 views

Issue with apex:input datetime

I have a page where a patient enters the appointment date for consulting, I m showing a dateTime input fields as <apex:input type="datetime-local" value="{!appointmentDate1}" styleClass="bRadius ...
1
vote
1answer
21 views

Setting a default TIME value only, on a Date/Time field

We have a Date/Time field on a custom object which lets us choose the date (perfect!), but defaults the time as 12:00:00. We want it to default to 09:00:00. I tried to go and change the default ...
0
votes
1answer
27 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
41 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
15 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
1answer
18 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
30 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
38 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
628 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
55 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
137 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
36 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
86 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
104 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
48 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
132 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
63 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
107 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
63 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
111 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
104 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
288 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
56 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
663 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
36 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 ...