Adding day/hour/minute/second to a date value
How does one add a day/hour/minute/second to a date value?
SQL> select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') to_day,
2 to_char(sysdate+1, 'DD/MM/YYYY HH24:MI:SS') add_day,
3 to_char(sysdate + 1/24, 'DD/MM/YYYY HH24:MI:SS') add_hour,
4 to_char(sysdate + 1/(24*60), 'DD/MM/YYYY HH24:MI:SS') add_minute,
5 to_char(sysdate + 1/(24*60*60), 'DD/MM/YYYY HH24:MI:SS') add_second
6 from dual
7 /
TO_DAY ADD_DAY ADD_HOUR ADD_MINUTE ADD_SECOND
10/10/2006 11:54:23 11/10/2006 11:54:23 10/10/2006 12:54:23 10/10/2006 11:55:23 10/10/2006 11:54:24
SQL>Cheers
Sarma.
Similar Messages
-
itune 11.0.0.163 shows silly date approximation on bottom bar rather than days, hours, minutes, seconds as before. How do I change this?
Apple buried the transfer purchases option, but it's still there. To transfer purchases from your iOS device in iTunes:
Select the device toward the top-middle of iTunes (underneath the status area/progress bar/Apple logo).
Go to the File menu.
Select Devices
Click on Transfer Purchases from [DeviceName]... -
Calcuate Hours: Minutes:Seconds between two dates excluding Weekends
Hello All,
@StartDate = '2014-06-21 13:37:30:037'
@EndDate = GetDate()
I want to find out Hours:Minutes:Seconds between the above dates EXCLUDING WEEKENDS.
Please help.
ReportingServicesHi,
Give this a try:
DECLARE @StartDate DATETIME = '2014-06-21 13:37:30:037'
DECLARE @EndDate DATETIME = GETDATE()
DECLARE @Base INT = 86400 -- ie Seconds in a days
;WITH cteCalculation AS (
SELECT ((
(DATEDIFF(dd, @StartDate, @EndDate) + 1)
-(DATEDIFF(wk, @StartDate, @EndDate) * 2)
-(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)
) * @Base)
-(CASE WHEN DATENAME(dw, @StartDate) NOT IN ('Saturday', 'Sunday') THEN DATEPART(hh, @StartDate) * 3600 + DATEPART(mi, @StartDate) * 60 + DATEPART(ss, @StartDate) ELSE 0 END)
-(CASE WHEN DATENAME(dw, @EndDate) NOT IN ('Saturday', 'Sunday') THEN @Base - (DATEPART(hh, @EndDate) * 3600 + DATEPART(mi, @EndDate) * 60 + DATEPART(ss, @EndDate)) ELSE 0 END)
AS DiffInSec
SELECT @StartDate
,@EndDate
,CAST(DiffInSec / 3600 AS VARCHAR(10)) + ':' +
RIGHT('0' + CAST((DiffInSec % 3600) / 60 AS VARCHAR(2)), 2) + ':' +
RIGHT('0' + CAST((DiffInSec % 3600 % 60) AS VARCHAR(2)), 2)
FROM cteCalculation
Feel free to modify to suit your needs!
Hope this helps.
~J. -
Convert seconds to Days, hours, Minutes, Seconds in Reporting Services
Hi Guys,
Im currently reporting of an analysis services cube, however I have value which is in seconds and would like to report on this in reporting services as day:HH:MM:SS.
Has anyone got any experience reporting in this format?
Regards
DaveHi Dave,
We can use custom code to convert seconds to HH:MM:SS
Public Function Calculate(ByVal TotalSeconds as Integer) as String
Dim Hours, Minutes, Seconds As Integer
Dim Hour, Minute, Second As String
Hours = floor(TotalSeconds/ 3600)
IF Hours<10
Hour="0" & Hours.ToString
Else
Hour=Hours.ToString
End IF
Seconds = TotalSeconds Mod 3600
Minutes =floor( Seconds / 60)
IF Minutes<10
Minute="0" & Minutes.ToString
Else
Minute=Minutes.ToString
End IF
Seconds = Seconds Mod 60
IF Seconds<10
Second="0" & Seconds.ToString
Else
Second=Seconds.ToString
End IF
Return Hour & ":" & Minute & ":" & Second
End Function
Then we can use the expression to conver it.
=Code.Calculate(Fields!Column.Value)
The report looks like below:
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support -
Convert Format Day, Hour, Minute, Seconds in Hours
Hi all,
I have one report generate by VoIP application like this:
Total of hour has showed in Day (4). hour (20): Minute (26): seconds (06) summarize 4.20:26:06
I need convert this format only how like 116 (hours) 26 (twenty six) Minutes 06 (Six) seconds. summarize 116:26:06
How I can make this?
Regards!
Douglas Filipe http://douglasfilipe.wordpress.comHi,
I'm marking the reply as answer as there has been no update for a couple of days.
If you come back to find it doesn't work for you, please reply to us and unmark the answer.
Thanks
George Zhao
Forum Support
Come back and mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback on our support, please click "[email protected]" -
Date difference in Days,hours minutes and seconds.
Hi All,
I have two date Suppose one is getdate() and other one is gatedate() +1 .I have to show the difference, currently I used a datediff in the stored proc which just shows the difference of the days :( but i need to show the difference in days:hours:minutes:seconds if possible.
its a countdown with the current date. Like the two fields are sale_start_date and sale_end_date. Hope i am clear.
Please let me know ASAP thanks in advance.Can anyone help me?all help is great help.
Say the difference of
12/6/2007 7:00:00 AM, 12/8/2007 8:00:00 AM as 2 days 1:00:00)
Thanks
NOne of the problems of using DATEDIFF when dealing with either seconds or milliseconds is that this function will result in execution errors if the start and end dates span then entire domain of possible dates. Below is an alternative that seems to work over the entire date domain. A couple of things to note:
1. This select converts the days and seconds of each date into BIGINT datatypes to avoid the overflow error
2. This select uses a CROSS APPLY operator; in this case I chose CROSS APPLY to suggest the possibility of converting this select into an inline table function.
I suspect that if you dig around this forum and the net that you will find a better routine, but here is yet another alternative:
declare @test table
( startDate datetime, endDate datetime)
insert into @test values
('6/1/9', getdate()),
('6/9/9 15:15', '6/10/9 19:25:27.122'),
('6/9/9 15:15', '6/10/9 13:25:27.122'),
('6/9/9', '6/10/9 00:00:01'),
('1/1/1760', '12/31/2999')
select
startDate,
endDate,
[Days],
[Hours],
[Minutes],
[Seconds]
from @test
cross apply
( select
cast((endSecond - startSecond) / 86400 as integer) as [Days],
cast(((endSecond - startSecond) % 86400) / 3600 as tinyint) as [Hours],
cast(((endSecond - startSecond) % 3600) / 60 as tinyint) as [Minutes],
cast((endSecond - startSecond) % 60 as tinyint) as [Seconds]
from
( select
86400 * cast(convert(integer, convert(binary(4),
left(convert(binary(8), startDate),4))) as bigint)
+ cast(convert(integer, convert(binary(4),
right(convert(binary(8), startDate),4)))/300 as bigint)
as startSecond,
86400 * cast(convert(integer, convert(binary(4),
left(convert(binary(8), endDate),4))) as bigint)
+ cast(convert(integer, convert(binary(4),
right(convert(binary(8), endDate),4)))/300 as bigint)
as endSecond
) q
) p
/* -------- Sample Output: --------
startDate endDate Days Hours Minutes Seconds
2009-06-01 00:00:00.000 2009-06-22 08:28:36.670 21 8 28 36
2009-06-09 15:15:00.000 2009-06-10 19:25:27.123 1 4 10 27
2009-06-09 15:15:00.000 2009-06-10 13:25:27.123 0 22 10 27
2009-06-09 00:00:00.000 2009-06-10 00:00:01.000 1 0 0 1
1760-01-01 00:00:00.000 2999-12-31 00:00:00.000 452900 0 0 0
(5 row(s) affected)
EDIT:
I based the routine more-or-less on Thilla's reply.
Kent Waldrop -
Convert :- Minutes to Days:Hours:Minutes
Hi Friends ,
I want to convert the time value from MINUTE to HH : MM : SS
I mean in input i have to pass 200 Minutes and in Output i want to get the no of hr and minutes in the format 03 : 20 ( HH:MM) . I have used the FM "CONVERSION_EXIT_SDURA_OUTPUT" for this .
This works fine for time input values upto 5 digits like ( 20000 minutes) = 333:20 (HH:MM) ,
when the input value is more than 5 digits , ex - 200000 this FM does not work .
Is there any FM where i can get the conversion from MINUTE to HH :MM:SS or from Minutes to DAYS :HPURS:MINUTES .
I have searched SDN , but i dint get the exact FM which i want ,
If any body has any idea on the same please guide me on the same .
Regards
ParbhuduttaThanks all for all of your valuable inputs .
IBy using FM : MONI_TIME_CONVERT , i am able to get HH:MM:SS format data by giving input as seconds .
But the issues i have is , i have data as input in seconds which is noear to a 10 digit number like
200000000 seconds , which does not work for this FM .
I have input data in MINUTES which is near to 10 digit , exmp - 239879798 minutes . So i want to convert this no to ( DAYS : HOURS : MINUTES : SECONDS )
Other FMs that has been given by you guys i have checked but i am not able to get exactly what i want .
Anyway thanks again .
Reagards
Prabhudutta -
How to show number of days:hours:min:second
Hi !
Need your help on this one:
I have to calculate the number of ( Days;Hours:Minute:Second ) that a ticket have been opened
But I have a problem to display the format that I want: DD:HH:MM:SS
EX:the ticket have been opened 2011-05-03 11:00:00
first I create a formula to show number of second to show how long the ticket have been opened since the currentDate in seconds
Formula Name is:
{@number of seconds OpeningTime}
Crystal Syntax:
DateTimeVar dt1:= {@DTOpenDate};
DateTimeVar dt2:= {@CurrentDateTime};
If dt2 >= dt1 Then
NumberVar ds:= (Date(dt2) - Date(dt1))*86400;
NumberVar hs:= (Hour(dt2) - Hour(dt1))*3600;
NumberVar ms:= (Minute(dt2) - Minute(dt1))*60;
Numbervar ss:= Second(dt2) - Second(dt1);
NumberVar ts:= dshsms+ss)
Else
NumberVar ds:= (Date(dt2) - Date(dt1))*86400;
NumberVar hs:= (Hour(dt2) - Hour(dt1))*3600;
NumberVar ms:= (minute(dt2) - Minute(dt1))*60;
NumberVar ss:= Second(dt2) - Second(dt1);
NumberVar ts:= dshsms+ss)
then I create another formula to display the format that I want:Ex:if the ticket have been opened for about 25hh:00mm:00ss
i want to show 01:01:00:00
DD:HH:MM:SS
Formula name: {@DTConversionOpeningTime}
I use Crystal Syntax:
WhilePrintingRecords;
StringVar Days1;
StringVar Hours1;
StringVar Minutes1;
StringVar Seconds1;
NumberVar Duration:=0;
Duration:= {@number of seconds OpeningTime};
If Duration < 0 Then
"Cannot have a time less than zero"
Else
(Days1:=ToText(Truncate(Duration/86400),0);
Hours1:=ToText(Truncate(Duration/3600),0);
Minutes1:=ToText(Truncate(Remainder(Duration,3600)/60),0);
Seconds1:=ToText(Remainder(Remainder(Duration,3600),60),0));
//Display format
(if length(Hours1) < 2 then '0')+ Days1 + ":" +
["0",""][length(Hours1)]+ Hours1 + ":" +
["0",""][length(Minutes1)] + Minutes1 + ":" +
["0",""][length(Seconds1)] + Seconds1;
Thanks for your helpFind a solution, see thread:
Re: Converting a calculated field into format of dd:hh:mm:ss answered by Jason Long -
Displaying the hour, minute, seconds.....
Hi fellow experts!
Once again I call upon you for help. I'm strugglng with the formatting of dates...specifically the hour, minute, seconds between two dates.
Sample data:
create table test (script_name varchar2(50),run_start date,run_end date, job_id number, parent_job_id number);
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMPORTMTM','09-FEB-10','09-FEB-10','2409671','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('INT_EOD_VALUATIONS','09-FEB-10','09-FEB-10','2409673','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('ACC_EOD_FXACCOUNTING','09-FEB-10','09-FEB-10','2409677','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FXUPDATE ','09-FEB-10','09-FEB-10','2409679','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('MX_PREACCOUNTING_BACKUP_RP','09-FEB-10','09-FEB-10','2409683','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('DM_PREACCOUNTING_BACKUP_RP','09-FEB-10','09-FEB-10','2409684','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMP_FIXING','09-FEB-10','09-FEB-10','2409688','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FIXINGIRD','09-FEB-10','09-FEB-10','2409690','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('WAIT_5_MINS','09-FEB-10','09-FEB-10','2409692','2409645');
The output of the time should look like the results from the query below:
select floor((run_end-run_start)*24) as Hrs ,floor(((run_end-run_start)*1440 - floor((run_end-run_start)*24)*60)) as Mins,
ceil(((run_end-run_start)*86400 - floor((run_end-run_start)*1440)*60)) as Secs
from (
select to_date('10-oct-2003 15:02:23','DD-Mon-YYYY HH24:Mi:SS') as run_start,
to_date('10-oct-2003 16:20:20','DD-Mon-YYYY HH24:Mi:SS') as run_end
from dual);
i.e
H M S
1 17 57
My current sql is:
select script_name,
run_start,
run_end,
floor((run_end-run_start)*24) as Hrs ,floor(((run_end-run_start)*1440 - floor((run_end-run_start)*24)*60)) as Mins,
ceil(((run_end-run_start)*86400 - floor((run_end-run_start)*1440)*60)) as Secs
from (
select lpad(' ',5*level,' ')||name script_name
,to_date(run_start,'dd-mon-yyyy hh24:mi:ss') run_start, to_date(run_end,'dd-mon-yyyy hh24:mi:ss') run_end,
sys_connect_by_path(to_date(run_start,'dd-mon-yyyy hh24:mi:ss'),'/') root_start
from jcs_jobs
connect by prior job_id = parent_job_id
start with PARENT_JOB_ID IS NULL and job_id = 2409645
I need a slight tweak somewhere, but can't quite get there!
Oracle version is 9i
Many thanks for your help in advance.
DevHi,
Devski Peters wrote:
......sorry, I didn't make myself clear.....Sorry, this message made things even less clear.
Like Bhushan, I don't see any relationship between the data you posted:
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMPORTMTM','09-feb-2010 20:00:02','09-feb-2010 20:00:44','2409671','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('INT_EOD_VALUATIONS','09-feb-2010 20:00:44','09-feb-2010 20:01:03','2409673','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('ACC_EOD_FXACCOUNTING','09-feb-2010 20:01:05','09-feb-2010 20:01:24','2409677','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FXUPDATE ','09-feb-2010 20:01:24','09-feb-2010 20:01:43','2409679','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('MX_PREACCOUNTING_BACKUP_RP','09-feb-2010 20:01:45','09-feb-2010 20:01:49','2409683','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('DM_PREACCOUNTING_BACKUP_RP','09-feb-2010 20:01:45','09-feb-2010 20:01:49','2409684','2409645');
insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMP_FIXING','09-feb-2010 20:01:51','09-feb-2010 20:02:15','2409688','2409645');and the results you want:
NORMAL_DAY 09-feb-2010 18:05:00 10-feb-2010 04:22:45 20'681'879.88
Step 1 of NORMAL_DAY 09-feb-2010 18:05:00 09-feb-2010 18:05:24 575.88
Step 2 of NORMAL_DAY 09-feb-2010 18:05:24 09-feb-2010 18:05:46 527.88
EOD_FX_RATE_UPLOAD 09-feb-2010 18:05:24 09-feb-2010 18:05:46 527.88
Step 1 of EOD_FX_RATE_UPLOAD 09-feb-2010 18:05:24 09-feb-2010 18:05:30 143.88
FX_FTPS_GET_EOD 09-feb-2010 18:05:26 09-feb-2010 18:05:30 95.88
Step 2 of EOD_FX_RATE_UPLOAD 09-feb-2010 18:05:30 09-feb-2010 18:05:45 359.88
FXSPOTS 09-feb-2010 18:05:31 09-feb-2010 18:05:45 335.88
Step 3 of EOD_FX_RATE_UPLOAD 09-feb-2010 18:05:45 09-feb-2010 18:05:46 23.88
SEND_MAIL_FXSPOTS 09-feb-2010 18:05:45 09-feb-2010 18:05:46 23.88
Step 3 of NORMAL_DAY 09-feb-2010 18:05:46 09-feb-2010 18:06:10 1'535.88
CALENDAR_UPLOAD 09-feb-2010 18:05:47 09-feb-2010 18:06:10 1'511.88
Step 1 of CALENDAR_UPLOAD 09-feb-2010 18:05:47 09-feb-2010 18:05:53 143.88
CALENDAR 09-feb-2010 18:05:47 09-feb-2010 18:05:53 143.88
Step 2 of CALENDAR_UPLOAD 09-feb-2010 18:05:53 09-feb-2010 18:06:00 1'127.88
MDS_STOP 09-feb-2010 18:05:53 09-feb-2010 18:06:00 1'127.88
Step 3 of CALENDAR_UPLOAD 09-feb-2010 18:06:00 09-feb-2010 18:06:03 71.88
MDS_HOLIDAY 09-feb-2010 18:06:00 09-feb-2010 18:06:03 71.88
Step 4 of CALENDAR_UPLOAD 09-feb-2010 18:06:03 09-feb-2010 18:06:10 167.88Do you really want that data to produce that output?
If the results are not from that data, then post a consistent set of data and results.
When you have poted some sample data and the results you want from that data , explain how you get those results. Pick a couple of rows of output, and explain how you got every column in the results from the data. Be specific.
The table has a 'pig ear' relationship......so job_id can have the same parent_job_id.....What is a "pig ear" relationship? (I like the name.)
>
The connect by allows me display the results with indentation, so the results will look like:The results look completely unformatted on my browser.
When you post any formatted text on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after each formatted section.
So for example,the first line shows a time of 20'681'879.88, which works out to 10:18 hours approx. Explain the relationship between 20'681'879.88 and "10:18 hours". (Do you mean 10 hours plus 18 minutes?) -
In DB2, I can get the value of year, month, date, hour, minute, second from current timestamp by year(), month(), date(), hour(), minute(), second(). Like below SQL,
SELECT current timestamp, year(current timestamp), month(current timestamp), date(current timestamp), hour(current timestamp), minute(current timestamp), second(current timestamp) FROM DUAL
In Oracle, how can I modify above SQL?
That is, do we have the corresponding function to each one of them in DB2?
Thanks,
JJHi Turloch,
Thanks for your help.
Here, I have another question.
How about the days caculation?
For example, in DB2, I have a SQL as below,
select
account_no
from
lit_transaction
where
( start_date + no_of_days days - exp_days days) <= CURRENT DATE
How can I modify above days caculation for Oracle?
Thanks,
J. -
Save date with precision (Hour, Minutes, seconds ) using V.O.
Hi all,
I'm using Jdeveloper 11g.
I have an Entity object with a column called 'createdOn' of type Date and an entity based View Object with the same type.
I'm trying to save today's Date with precision (day, month, year, hour, minutes, seconds) Using the view Object, but when I look in the Data Base, always appears the date without time.
Here is my code in the application Module to save the data, I've tried some things but nothing...
First I've tried using oracle.jbo.domain.Date, and I've tryed using Calendar as well. Nothing with
ViewObjectImpl voSample = getSamples1View1();
//Date creation for View Object
oracle.jbo.domain.Date today = new Date(Date.getCurrentDate());
//Calendar today = Calendar.getInstance();
//loop through the list of samples (TESTGROUPTYPES), and create the objects
while( it.hasNext())
Row rowSample = voSample.createRow();
SequenceImpl sequence = new SequenceImpl("SAMPLES_SEQ", voSample.getApplicationModule());
rowSample.setAttribute("SampleId", sequence.getSequenceNumber());
rowSample.setAttribute("CollectionId", stCollectionId);
rowSample.setAttribute("TestgroupType",it.next());
rowSample.setAttribute("UnitId",stUnitId);
rowSample.setAttribute("SampleStatus", "ORDERED");
rowSample.setAttribute("SampleBackup", "false");
rowSample.setAttribute("CreatedOn", today);
voSample.insertRow(rowSample);
voSample.getApplicationModule().getTransaction().commit();
Any help will be usefull,
thanks in advance
XAVI.Hello John,
yes, I changed the date mask using
alter session set NLS_DATE_FORMAT='DD/MM/YYYY-hh24:mi:ss'
if i execute to_char(<date_column>, 'YY-MON-DD HH:MI:SS') on that column, the result is:
09-MAY-27 12:00:00
09-MAY-27 12:00:00
09-MAY-27 12:00:00
To launch the queries and see the results I'm using the JDeveloper's SQL WorkSheet.
I can update the data and time and the time persists in the DB
08-FEB-26 08:07:56
so, i think there's something in hte EO, VO or App Module method that I'm doing wrong...
The Entity Attribute is confirured:
name: CreatedOn
Type: Date
Value type: literal
Values checked: Persistent, Precision Rule and Queryable
database column: CREATED_ON, type: DATE
The View attribute is configured:
Name: CreatedOn
Type: Date
Value type: Literal
checked: Mapped to Column or SQL, Selected in query, queryable
query column: Alias: CREATED_ON, Type: DATE -
I would like to download an application for my desktop and maybe even my iphone that will tell me how many days, hours, minutes, etc have elapsed since a particular date.
For example, my brother just had a baby and I want to put that date and time into the app and then determine how long it has been since that date and time.
Hopefully this makes sense, because I have not been able to locate anything.
Thanks in advance,This is fantastic. Thank you.
Is there any way to have something like this displayed on my desktop showing the time as it ticks away? -
Thanks for your help.
Hi Raja,
I just want to add something in the drop down list
'Hour'
'Minute'
'Second'
I hope I can get these values from a domain value range.
Could you please assist ?
Anders -
DatePicker: clear hours, minutes, seconds?
Hi,
I am using one date picker to compute the difference between two dates. In the Interface Builder I have declared the date picker as date only. But the date passed from the date picker to the NSDate field has hours, minutes, second on it. For some reason the hours, minutes, seconds is different from my first date to the 2nd date (shown below). For this calculation I am only interested in whole days and the hours, minutes, and seconds are getting in the way of my calculation. Is there any way to use only whole days, or to set the hours, minutes, seconds to zero before I call timeIntervalSince1970?
NSDate *xbuydate = datePicker.date;
NSLog(@"xbuydate : %@", xbuydate);
buyElapsed = [xbuydate timeIntervalSince1970];
NSLog result:
5/26/09 3:49:18 PM AA-tab bar[596] xbuydate : 2000-01-01 17:00:00 -0700
NSDate *xselldate = datePicker.date;
NSLog(@"xselldate : %@", xselldate);
sellElapsed = [xselldate timeIntervalSince1970];
NSLog result:
5/26/09 3:49:33 PM AA-tab bar[596] xselldate : 2007-12-31 15:49:22 -0700Hi, this is my version: -)
@implementation NSDate(Utils)
- (NSDate *)truncateToDay
NSDate *result;
if (self == nil) {
return nil;
} else {
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents *comps = [[NSCalendar currentCalendar] components:unitFlags fromDate:self];
result = [[NSCalendar currentCalendar] dateFromComponents:comps];
return result;
Works without a problem so far. -
Localized text for hour, minute, second, week, today, etc.
You are able to get localized text for the weekday name, e.g. to get your localized name of "monday", use
SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
String name = sdf.format(gregorianCalendar.getTime())for month names, you would use the format String MMMM:
SimpleDateFormat sdf = new SimpleDateFormat("MMMM");Are there additional localized text available through some API? I'm looking for translations for "next", "previous", "day", "week", "month", "year", "hour", "minute", "second", "now", "today", "OK", "Cancel". (Of course, I could translate these myself and offer a MessageBundle, but if there are already translations down there through the API, why do work twice ;-)You are able to get localized text for the weekday name, e.g. to get your localized name of "monday", use
SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
String name = sdf.format(gregorianCalendar.getTime())for month names, you would use the format String MMMM:
SimpleDateFormat sdf = new SimpleDateFormat("MMMM");Are there additional localized text available through some API? I'm looking for translations for "next", "previous", "day", "week", "month", "year", "hour", "minute", "second", "now", "today", "OK", "Cancel". (Of course, I could translate these myself and offer a MessageBundle, but if there are already translations down there through the API, why do work twice ;-)
Maybe you are looking for
-
Installation Problem on iTunes 6.0.1.3 - HpSdpAppCoreApp
Help! I'm trying to install the new iTunes 6.0 and I'm getting a message during installation that says HpSdpAppCoreApp "The feature you are trying to use in on a network resource that is unavailable. Click OK to try again, or enter an alternative pat
-
Suggestion for not picking up the same record
Hi All, I have a plsql procedure that picks up the records from the same table from multiple threads. Different threads should not pick up the same record. Current Logic: I am locking the row that has been picked up the current thread and the next th
-
Synchronization failed using sample function group SDOE_SAMPLE_BAPIWRAPPERS
Hi all, I'm using SAP Netweaver Mobile 7.1. I've created an application using a BAPI wrapper with the BAPI of the sample function group 'SDOE_SAMPLE_BAPIWRAPPERS'. Everithing works fine. I'm able to create locally a new contact with its related addre
-
Hi! In reference to "jarring up" my app, does the jar only contain the referenced import statements? In other words, is there extra API or librarys that are not being used by my app also just sitting in there taking up space? Thanks!
-
Finding pdf files from imac to iPad 2
I have some PDF files (2) that I synced to my iPad 2 but I can't find them anywhere on my iPad. First, I opened iTunes, then went to the Apps, selected Pages, then Add , then Synced... They appear to be then synced to my iPad. Also, I included on Pa