Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A value that indicates a particular day and time, such as a timestamp.
4
votes
Calculating duration of time using only Hours, Minutes and Seconds
a new formula field of type Number with two decimal places:
((DATETIMEVALUE("2010-01-01 " + Time2__c) - DATETIMEVALUE("2010-01-01 " + Time1__c))*1440)
This formula uses these times and created two datetime …
1
vote
Use JavaScript functions on a Visualforce page
If you want to assign your apex date variable to some javascript variable you can do it just by creating a new Date with your apex variable as parameter:
<script>
var d = new Date('{!date}');
…
2
votes
ADD or SUBTRACT hours from TODAY and YESTERDAY functions in soql
You can use Date Formats and Date Literals together with Date Functions directly in the SOQL query:
Select Id
From Account
Where CreatedDate = TODAY
And HOUR_IN_DAY(CreatedDate) = 6
6
votes
Finding opportunities closed in last week
Here is a cool doc about date formats in SOQL: Date Formats and Date Literals
You could use LAST_WEEK for sure.
Something like:
Select Id, Name From Opportunity Where CloseDate = LAST_WEEK
2
votes
Accepted
SubString of a Date in Apex?
String myDate = o.CloseDate.year() + '-' + o.CloseDate.month() + '-' + o.CloseDate.day();
Or:
String myDate = String.valueOf(o.CloseDate).SubString(0,10);
21
votes
Accepted
Getting format for date
UPDATE
For the following format
February 2, 2013
please use:
Datetime myDatetime = Datetime.now();
String myDatetimeStr = myDatetime.format('MMMM d, yyyy');
Im using the following functions … for the timestamp:
// This method returns a whole timestamp as a string
public String timeStamp(){
Datetime dt = Datetime.NOW();
String day = checkLength(String.valueOf(dt.day()));
String …
22
votes
Accepted
Date Calculation in Apex?
Use daysBetween
date startDate = date.newInstance(2008, 1, 1);
date dueDate = date.newInstance(2008, 1, 30);
integer numberDaysDue = startDate.daysBetween(dueDate);
Here ist the doc: Date Methods
5
votes
Accepted
Setting default value for datetime field
You need to use DATETIMEVALUE(...) function, like this:
DATETIMEVALUE("2013-11-15 12:00:00")
Or just NOW() function
Read more about functions
1
vote
Timezone issue with Datetime Field [again ;-)]
hour: Returns the hour component of a Datetime in the local time zone
of the context user minute: Returns the minute component of a Datetime
in the local time zone of the context user
(From here: … Datetime Methods)
So why can't you just create a time you want from a goven Datetime? …
2
votes
Accepted
Date format in email template
I think here you will be needed an apex method, something like this:
public List<String> monthList = new List<String>{'January',
'February',
…
2
votes
Calendar does not work properly
Will you believe me or not, the problem here is, that the event was misspelled:
onChange ---> wrong
onchange ---> right
This is the case for the Salesforce support team.
2
votes
Accepted
difference between two date time fields in days
I have tested the following:
NOW() field (DateTime formula)
DateTime field
Difference field with formula NOW()- ut__Datetime__c (number formula, 2 decimal places)
Works well: …