Skip to main content

Featured

[XrmToolBox] Use FetchXML Builder

FetchXML Installation : XrmToolBox 1. Open XrmToolBox And Find FetchXML Builder 2. Start FetchXML Builder 3. Click the fetch from node 사용은 Top 또는 Paging 둘 중 하나만 가능 Paging size : 한 페이지에 보여줄 레코드 개수 Dstinct : 페이지에 보여지는 레코드 중복 제거 No-lock : 테이블 lock 거는 것을 풀어줌 (조회 할 때 퍼블리시되지 않은 값도 들어올 수 있음) Page : 페이지 (미입력시 1 페이지) 4. Click entity form node 조회할 Entity Name을 선택 후, Select Attributes 클릭 조회할 Entity의 Attirbute를 선택하여 확인 link-entity 클릭 Relationship을 클릭하여 링크할 관계 선택 후 결과

JavaScript Date To String ISO 8601

i just made for input to DB (e.x. '1991-01-01')

Example Link : http://jsfiddle.net/kaL0zm8r/1/
Code:
///<summary>
/// isDateOnly default : true
/// hms defualt : null (example to using "09:00:00") this parameter using when isDateOnly is false.
/// isShowUTCTimeZone default : null (example to using UTC Timezone shows like this "+09:00" ).
///</summary>
function DateToStringISO8601(date, isDateOnly, hms, isShowUTCTimeZone) {
    var datestring = "";

    if (date == null || date == "") {
        return "";
    }
    if (Object.prototype.toString.call(date) !== "[object Date]") {
        date = new Date(date);
        //if Date is NaN, set Today
        if (isNaN(date)) {
            date = new Date();
        }
    }

    datestring = date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + ("0" + date.getDate()).slice(-2);
    if (isDateOnly != null && isDateOnly === false) {
        if (hms == null || hms === "") {
            datestring += "T" + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2) + ":" + ("0" + date.getSeconds()).slice(-2);// + "." + ("00" + date.getMilliseconds()).slice(-3);
        }
        else {
            var arr = hms.split(':');
            if (arr.length !== 3) {
                datestring += "T" + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2) + ":" + ("0" + date.getSeconds()).slice(-2); // + "." + ("00" + date.getMilliseconds()).slice(-3);
            }
            else {
                if ((parseInt(arr[0]) <= 24 && parseInt(arr[0]) >= 0) && (parseInt(arr[1]) <= 60 && parseInt(arr[1]) >= 0) && (parseInt(arr[2]) <= 60 && parseInt(arr[2]) >= 0)) {
                    datestring += "T" + ("0" + arr[0]).slice(-2) + ":" + ("0" + arr[1]).slice(-2) + ":" + ("0" + arr[2]).slice(-2);
                }
                else { //IF hms set wrong, set date's hms
                    datestring += "T" + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2) + ":" + ("0" + date.getSeconds()).slice(-2); // + "." + ("00" + date.getMilliseconds()).slice(-3);
                }
            }
        }
    }
    if (isShowUTCTimeZone != null && isShowUTCTimeZone === true) {
        var offset = date.getTimezoneOffset();
        var hour = parseInt(offset / 60);
        var min = parseInt(offset % 60);
        if (hour > 0 || min > 0) { //+ means UTC - 
            datestring += "-" + ("0" + hour).slice(-2) + ":" + ("0" + min).slice(-2);
        }
        else if (hour < 0 || min < 0) { // - means UTC +
            datestring += "+" + ("0" + (hour * -1)).slice(-2) + ":" + ("0" + (min * -1)).slice(-2);
        }
        else if (hour === 0 || min === 0) {
            datestring += "Z"; //Z mean '+00:00'
        }
    }
    return datestring;
}

Comments

  1. Golden Nugget Casino & Hotel - MapYRO
    Golden Nugget Casino & Hotel. 부산광역 출장마사지 MapYRO 전라북도 출장마사지 Hotels & Casinos. View reviews, amenities, contact details & maps. 논산 출장샵 Rating: 2.5 삼척 출장안마 · 보령 출장안마 ‎6 votes

    ReplyDelete

Post a Comment

Popular Posts