Questions tagged [datetime]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
25 views

How to trim out “Date” from Date/Time field in Salesforce?

I have a Date/Time field (call it Field A) that gets populated by an external system, i'd like to create another field that trims/extracts the Time value from Field A. I want to do this to use a ...
0
votes
1answer
21 views

Convert two separate fields Date and time fields to milliseconds

I have two separate fields Date and Time fields. I would like to convert these fields into seconds format. I am using this seonds format to make google API call. https://maps.googleapis.com/maps/...
0
votes
1answer
30 views

Apex format function returning weird dates

I am attaching a screenshot which shows a code sample and it's output also. When I normally debug the created date it shows me correct output and then when I try to format it using format function it ...
0
votes
1answer
31 views

The issue in DateTime Field while saving from lightning component

I'm facing the issue in the Datetiem field type in the lightning component. I'm using for input and call apex method to save the fields for one of my events. Requirement: Save the 2 DateTime field ...
0
votes
1answer
59 views

How to convert UTC to IST conversion in apex?

I am getting the time as string like "client_modified": "2020-02-04T11:27:34Z" How can I convert this to local time zone, Update: I am getting this time from api response I need to display it in ...
0
votes
0answers
23 views

Date Time field - how to get field value without adjustment?

I want to get a date and time that a user has input into salesforce, as they have input it, using apex. At the moment, if they input a time for a date after clocks go forward, it seems to be saved ...
3
votes
1answer
140 views

How to output [MMMM dd yyyy hh:mm AM/PM] using Text formula on a DateTime field?

Good day StackExchange! High level, my goal is to take a date/time value and use a formula to display it as a customer friendly long date (MMMM-DD,YYYY at HH:MM AM/PM) string output for email ...
1
vote
0answers
19 views

OutArguments to be used in journey builder (Decision box)

My CustomActivity (type- REST) returns an outArgument which is of DataType - DATE. I have configured the outArgument correctly and it is visible in the following widgets. MY customActivity is followed ...
1
vote
1answer
17 views

Datetime Value Issue during time conversion

I have executed following code on developer console and it shows incorrect hour. Since the time used is from Seattle (Pacific time) which is 8 hours behind GMT. So when datetime.hourGMT() is used ...
0
votes
0answers
33 views

Display seconds in formula using date/time

How can seconds be displayed in a formula field that references a rollup summary field that calculates the MAX value of datetime field from the child objects? The rollup summary contains a datetime ...
0
votes
1answer
32 views

How to get week name(Week1, week2 , week3 , week4 ) or number from the month in apex function

I have a requirement to create a record on weekly basis after checking if record is not created for the previous week. how to get the week number for each month and if i am in week 2 of month than how ...
1
vote
1answer
41 views

Changing Date time using DateTime - format(dateFormatString, timezone)

In below execute anonymous code I am seeing a strange behaviour. DateTime myDateTime = DateTime.newInstanceGMT(2019, 12, 30, 0, 0, 0); system.debug('myDateTime === ' + myDateTime); DateTime ...
1
vote
1answer
16 views

Invalid date and time error [duplicate]

I have a @restResource that's receiving a JSON payload as a string. I am taking that payload and placing it into a Map<String, Object> variable. I'm trying to save the date/time into a variable ...
-2
votes
1answer
45 views

How to get the current month and use in batch apex query

I want to get the current month from picklist field and use that current month in soql query in a batch class. I have written the following code and its not working. String month = Product.Month__c....
1
vote
2answers
46 views

Need help to convert the date time into EST in apex class

I have googled it but no proper solution I found it in any salesforce community. Scenario is we are making a callout and getting the response as string value like "2018-06-12T19:00:00-07:00". Now ...
1
vote
1answer
57 views

Process builder conditions when custom date/time is NOW()

Should be simple but I'm getting stuck on the formula Building a workflow in process builder and trying to trigger an action when custom object's custom date/time field is NOW().
0
votes
0answers
22 views

Date Format of DateTime in Select/Aura Iteration

Here is the code : <lightning:select aura:id="SelectRepport" name="PaymentType" label="repport Z" onchange="{!c.zRepportSelected}"> <option value="0">Chosse ...</option> <aura:...
0
votes
0answers
32 views

Time calculation in apex

My requirement is to assign records if the lastmodifiedDate of the record falls within the employee availability. For example let's say on Sunday employee available between 8.00 AM to 5.00 PM and if ...
3
votes
1answer
47 views

Datetime.newInstance and Datetime.newInstanceGmt are not working correctly

My user's timezone is GMT+2 (Eastern European Time) and I notice strange thing when playing around with dates. Date myDate = Date.newInstance(2019, 11, 29); Time myTime = Time.newInstance(9,0,0,0); ...
0
votes
1answer
22 views

Return of Datetime value

I am new to Apex. I have instantiated the Datetime field with (2019, 12, 31, 12, 12, 12) where hour/minute/sec all are '12'. but in the output it is returning '20:12:12'. Please help me to ...
0
votes
1answer
13 views

Updating datetime field from Visualforce remoteObjects

I m trying to update a datetime field from VF page using remoteObjets and I am getting this error: err: Error: Last Viewed Timestamp: value not of required type: 2019-11-20T11:00:56.373Z This ...
0
votes
1answer
25 views

DateTime.ValueOf(myString) returns date completely wrong

I'm not sure why this is happening. When I run System.Debug(DateTime.valueOf('2019-14-11 10:55:46 pm')); in Execute Anonymous I'm expecting it to return the same date but in a DateTime. However,...
1
vote
1answer
26 views

Date formatting for SOQL String - unexpected output

I have '273' added as a day with the following line: DateTime.newInstance(dStart.year(), dstart.month(), dstart.day()).format('DD-MM-YYYY'); so the output looks like '273-09-2019' - what gives? I ...
1
vote
1answer
41 views

What is the correct approach to create an Event in Apex for another User with their Timezone?

I'm trying to create an event for another user which needs to appear on their Calendar (in that user's Timezone). e.g. Current user's Timezone is Australia/Sydney, I need to create an event for a New ...
0
votes
2answers
116 views

Having trouble getting DateTime Property in LWC [closed]

Trying to do a simple LWC that displays relevant fields at the top of an opportunity. But one of the fields is a DateTime field and is giving me some significant problems. When I check in the console, ...
0
votes
1answer
53 views

SOQL Difference Between two datetime columns

I'm trying to find all records that have a difference of 5 years between two of their columns. A mysql example of this would be SELECT ... FROM custom_object__c where mydatabase_ID__c > 1 and ...
2
votes
1answer
62 views

Datetime conversion from date vs explicit midnight

I've just spent two days banging my head against the Salesforce wall, and the problem came down to this: Date wkStart = Date.newInstance(2019,10,12); Datetime wkStart1 = wkStart; Datetime wkStart2 = ...
0
votes
0answers
36 views

Event startDateTime shows more timestamp on Production

I have assigned custom timestamp to "starDateTime" standard field of event object by concatenating to custom date field but it shows additional 5:30 hours on Production.It works better in sandbox. I ...
2
votes
1answer
192 views

How to correctly convert Unix Timestamp with timezone offset into Apex Datetime?

There is a webservice which I'm trying to integrate in Salesforce. The webservice returns a date time in format like this /Date(1569301200000-0500)/ I believe this is Unix Timestamp, and we can ...
2
votes
1answer
37 views

MC Connector createdDate transformation

I believe there are some date transformations applied automatically when synchronizing records from SFDC to MC via the Connector I am talking about Created-date on Contact records for instance - I ...
0
votes
1answer
59 views

Formatting Dates and Time for SMS using AMPScript in Content Builder

Having a format issue on a SMS in Content Builder. Can someone point me to the correct code for this? Also would love some advice to learn basic AMPScript coding. Books? Tutorials? Online classes? ...
3
votes
1answer
68 views

How to convert String to DateTime without time zone conversion?

I have a requirement to convert string value to DateTime without converting it to time zone. Ex: Datetime today = Datetime.now(); String myDate = today.format('yyyy-MM-dd HH:mm:ss'); Datetime ...
-3
votes
1answer
48 views

Get number of milliseconds since January 1, 1970, 00:00:00 UTC in apex [closed]

I want the apex equivalent of the following javascript method : var utcDate3 = Date.UTC(2019, 7, 19, 18, 20, 5); Because I need the number of milliseconds in the given Date object since January 1, ...
0
votes
0answers
33 views

Get LanguageLocaleKey based on timezone ID

I have a custom object called Machine__c and i have a custom picklist field in it called Time_Zone__c. This Time_Zone__c field has the same picklist values as the Standard User object timezone field. ...
0
votes
0answers
41 views

Converting String to Date

I have date format which is returned from JSON which i get in String, how do I convert it to Salesforce date format ? Does anyone have knowledge which date format is this ? Following is the date ...
0
votes
1answer
47 views

APEX test script to web server with a static time stamp doget cakk and HttpGet

New to writing test scripts. Looking for help in error in Unexpected token 'Lead' for my test code. I have a static field that pulls off time stamp to only pull data after a certain time. I am ...
0
votes
0answers
84 views

SQL to post + 30 days by Date/Time attribute

Goal is to find rows where the date is exactly 30 days from today. Source is a Salesforce Date/Time field from a Synchronised Data Extension and posted to a regular Data Extension to Date attribute. ...
0
votes
1answer
69 views

Invalid Date Time

While trying to retrieve the headers from an integration response, I am getting a Datetime value in String format in the Header. Format - Mon, 01 Jul 2019 10:20:06 GMT I need to compare this with the ...
0
votes
1answer
37 views

Is there a way to detect actual user time zone (not Salesforce user acc.) in visualforce?

We have a "guest" form on our site, and a "guest" user to authenticate. Since the user has a set time zone, this is what (by default) is used by visualforce. Problem is, our Guest User will always be ...
0
votes
1answer
30 views

Can someone clear up datetime time zone behavior in visualforce email template?

Between the UI on direct records automatically adjusting to my time zone and not knowing default behavior in visualforce pages, I'm having trouble wrapping my head around what the user experience ...
1
vote
0answers
108 views

JSON time fields

We have a problem with deserialize and serialize salesforce time fields Since Json and salesforce time fields both consist of "colon" we need to replace with a special character before deserialize ...
0
votes
1answer
150 views

How to disable the blue border around all the element after selecting a time in lightning:input of type datetime?

I have a lightning:input of type datetime When I select a date it's ok, but when I select a time, after selecting during this "click" it's showing like a blue border around all the element. I know ...
0
votes
1answer
286 views

LocalizationService formatDateTime method is not displaying correct time in European Time format

I am not getting expected output in time value. I am passing value as 20190619131800Z through query parameter and trying to format it according to Salesforce User Timezone. I am using lightning:...
0
votes
0answers
276 views

“INVALID_TYPE_ON_FIELD_IN_RECORD” while updating date/dateTime field using SOAP client

I have a SOAP client which connects with Salesforce and do CRUD operations. Earlier I used to use Axis to generate stub and in that case it works perfectly but then I replaced axis with force-wsc due ...
0
votes
3answers
303 views

SOQL with Date filter in WHERE clause [duplicate]

@AuraEnabled public static List<StaffReport__c> getUserReports(String UserId, Date startDate, Date endDate) { return [Select Date__c from StaffReport__c where User__c =: UserId AND Date__c &...
0
votes
1answer
147 views

How to provide default DateTime value in UTC time

I am providing a default value to a DateTime field in my apex class. customobject.DateTime__c = DateTime.parse('01/01/1990 12:00 AM'); I want to set the default value to 01/01/1990 12:00 am UTC ...
0
votes
0answers
43 views

DateTime newInstance doesnt get in user locale

In my code I try to set datetime based on selected location. The Idea is, when the user select locale and then the time, record will be saved with selected datetime value based on selected locale. But ...
2
votes
1answer
286 views

onChange event is not fired for lightning:input type=“datetime” when clear Time field

I have the following component: Example.cmp <lightning:input aura:id="field" type="datetime" name="datetimeInput" label="Set up a date/time" ...
1
vote
0answers
129 views

SAQL Date format conversion

I am pulling in a date field from a secondary (Japan) SFDC org into our native org. The format in the Japan org shows it as just a date (yyyy-MM-dd) but when I look at the date in the data connection ...
2
votes
1answer
35 views

DateTime.parse doesn't take seconds or offset

DateTime.parse() won't take seconds or offsets, at least not in the US. The format from the documention in DateTime.methods() is the only one I can find that works: Datetime dt = DateTime.parse('10/...

1 2 3 4 5 12