Tuesday, October 28, 2014

Email Persetujuan Program Afiliasi dari Lazada.co.id


Hari ini merupakan awal kali permohonan program afiliasiku disetujui oleh salah satu toko online profesional dan terpopuler saat ini yaitu lazada.co.id

Yaa, cukup seneng juga, walaupun blog pemula ini belum banyak member, dan mungkin belum seumur jagung, tapi sudah mendapat kepercayaan dari lazada.com untuk mereferensikan/mengiklankan produk-produknya.

Terimakasih admin afiliasi lazada.co.id, semoga banyak pengunjung blog ini yang bertransaksi di toko online lazada.co.id.

Berikut email persetujuan program afiliasi dari lazada.co.id


Wednesday, October 15, 2014

Function SQL Mencari tanggal dari tanggal tertentu dengan fungsi dateadd pada Sybase


Function dateadd adalah sebuah function yang disediakan oleh Sybase untuk mencari suatu tanggal dari parameter tanggal tertentu, bedasarkan penambahan atau pengurangan parameter hari, bulan dan tahun.


dateadd

 

Description

Returns the date produced by adding a given number of years, quarters, hours, 
or other date parts to the specified date.

 

Syntax

dateadd(date_partintegerdate expression)

 

Parameters

date_part
is a date part or abbreviation. 
For a list of the date parts and abbreviations recognized by Adaptive Server, see “Date parts”.

numeric
is an integer expression.

date expression 
is an expression of type datetimesmalldatetimedatetime
or a character string in a datetime format.

 

Examples

Example 1

Displays the new publication dates when the publication dates of all the books 
in the titles table slip by 21 days:
select newpubdate = dateadd(day, 21, pubdate) from titles 

 

Example 2

Add one day to a date:
declare @a dateselect @a = "apr 12, 9999"select dateadd(dd, 1, @a)

--------------------------
Apr 13 9999

Example 3

Add five minutes to a time:
select dateadd(mi, 5, convert(time, "14:20:00"))

--------------------------
2:25PM

Example 4

Add one day to a time and the time remains the same:
declare @a timeselect @a = "14:20:00"select dateadd(dd, 1, @a)
--------------------------
2:20PM

 

Example 5

Although there are limits for each date_part, as with datetime values, 
higher values can be added resulting in the values rolling over to the next significant field:
--Add 24 hours to a datetime

select dateadd(hh, 24, "4/1/1979")
-------------------------- 
Apr  2 1979 12:00AM  

--Add 24 hours to a date
select dateadd(hh, 24, "4/1/1979")
------------------------- 
Apr  2 1979 

 

Usage

·dateadd, a date function, adds an interval to a specified date. 
For more information about date functions, see “Date functions”.
·dateadd takes three arguments: the date part, a number, and a date. 
The result is a datetime value equal to the date plus the number of date parts.
·If the date argument is a smalldatetime value, the result is also a smalldatetime
You can use dateadd to add seconds or milliseconds to a smalldatetime
but it is meaningful only if the result date returned by dateadd 
changes by at least one minute.
·Use the datetime datatype only for dates after January 1, 1753.  
datetime values must be enclosed in single or double quotes. 
Use the date datatype for dates from January 1, 0001 to 9999.  
date must be enclosed in single or double quotes.

Use charncharvarchar or nvarchar for earlier dates. 
Adaptive Server recognizes a wide variety of date formats. For more information, 
see “User defined datatypes” and “Datatype conversion functions”.

Adaptive Server automatically converts between character and datetime 
values when necessary 
(for example, when you compare a character value to a datetime value). 
Using the date part weekday or dw with dateadd is not logical, 
and produces spurious results. 
Use day or dd instead.

Table 2-7: date_part recognized abbreviations

Date part
Abbreviation
Values
Year
yy
1753-9999 (datetime)
1900-2079 (smalldatetime)
0001-9999 (date)
Quarter
qq
1-4
Month
mm
1-12
Week
wk
1054
Day
dd
1-7
dayofyear
dy
1-366
Weekday
dw
1-7
Hour
hh
0-23
Minute
mi
0-59
Second
ss
0-59
millisecond
ms
0-999

Function SQL mencari selisih Tanggal dalam Sybase

DATEDIFF function [Date and time]

Function

Returns the interval between two dates.

Syntax

DATEDIFF ( date-part, date-expression1, date-expression2 )


Parameters

date-part Specifies the date part in which the interval is to be measured.

For a complete listing of allowed date parts, see “Date parts”.

date-expression1 The starting date for the interval. This value is subtracted from date-expression2 to return the number of date parts between the two arguments.

date-expression2 The ending date for the interval. date-expression1 is subtracted from this value to return the number of date parts between the two arguments.

Examples

The following statement returns 1:

SELECT DATEDIFF( HOUR, '4:00AM', '5:50AM' )
FROM iq_dummy

The following statement returns 102:

SELECT DATEDIFF( MONTH, '1987/05/02', '1995/11/15' )
FROM iq_dummy

The following statement returns 0:

SELECT DATEDIFF( DAY, '00:00', '23:59' ) FROM iq_dummy

The following statement returns 4:

SELECT DATEDIFF( DAY, '1999/07/19 00:00', '1999/07/23
23:59' ) FROM iq_dummy

The following statement returns 0:

SELECT DATEDIFF( MONTH, '1999/07/19', '1999/07/23' )
FROM iq_dummy

The following statement returns 1:

SELECT DATEDIFF( MONTH, '1999/07/19', '1999/08/23' )
FROM iq_dummy

The following statement returns 4:

SELECT DATEDIFF(MCS, '2009-11-03 11:10:42.033185',
'2009-11-03 11:10:42.033189') FROM iq_dummy

The following statement returns 15:

SELECT DATEDIFF(MICROSECOND, '2009-11-10
14:57:52.722001', '2009-11-10 14:57:52.722016')
FROM iq_dummy

The following statement returns 1,500,000:

SELECT DATEDIFF(MCS, '2000/07/07/07 07:07:06.277777',
'2000/07/07/07 07:07:07.777777') FROM iq_dummy

Usage

This function calculates the number of date parts between two specified dates. The result is a signed integer value equal to (date2 - date1), in date parts.
DATEDIFF results are truncated, not rounded, when the result is not an even multiple of the date part.
When you use day as the date part, DATEDIFF returns the number of midnights between the two times specified, including the second date, but not the first. For example, the following statement returns the value 5. Midnight of the first day 2003/08/03 is not included in the result. Midnight of the second day is included, even though the time specified is before midnight.

SELECT DATEDIFF( DAY, '2003/08/03 14:00', '2003/08/08 14:00' ) FROM iq_dummy

When you use month as the date part, DATEDIFF returns the number of first-of-the-months between two dates, including the second date but not the first. For example, both of the following statements return the value 9:

SELECT DATEDIFF( MONTH, '2003/02/01', '2003/11/15' ) FROM iq_dummy;
SELECT DATEDIFF( MONTH, '2003/02/01', '2003/11/01' ) FROM iq_dummy;

The first date 2003/02/01 is a first-of-month, but is not included in the result of either query. The second date 2003/11/01 in the second query is also a first-of-month and is included in the result.
When you use week as the date part, DATEDIFF returns the number of Sundays between the two dates, including the second date but not the first. For example, in the month 2003/08, the dates of the Sundays are 03, 10, 17, 24, and 31. The following query returns the value 4:

SELECT DATEDIFF( week, '2003/08/03', '2003/08/31' ) FROM iq_dummy;

The first Sunday (2003/08/03) is not included in the result.

Wednesday, October 1, 2014

Penyebab Cetak Report Tidak Tampil Pada PowerBuilder 10

Pernah suatu ketika saya melakukan pencetakan report dari sebuah datawindow datanya tidak tampil melalui fungsi retrieve.
Return value dari fungsi dw_report.retrieve() bernilai -1, seolah-olah data tidak ada.
Berulang-ulang report tersebut dijalankan, tetapi hasilnya tetap nihil.
Tetapi anehnya jika object datawindow report tersebut dijalankan manual, datanya tampil sesuai hasil query.

Selidik punya selidik, ketika saya cek source SQLnya ternyata ada karakter ';' pada akhir statement query.
Setelah karakter ';' tersebut dihilangkan ternyata report tersebut bisa menampilkan datanya melalui fungsi retrieve.

Dengan demikian dapat disimpulkan sementara, script query pada datawindow Powerbuilder 10 tidak mengenal karakter ';' . Powerbuilder tidak menganggap sintax error, tetapi tidak dapat menampilkan hasil query.