本月的当前一周在SQL Server中显示错误

时间:2015-07-13 18:17:41

标签: sql-server datetime sql-server-2012

这就是七月份的样子。

enter image description here

我正在尝试使用以下代码选择当前月份的# Define an on_click() function that will print event data upon mouseclick def on_click(event): """Print event data on mouseclick""" print(event) 参数。

getdate()

期望结果为

declare @date datetime = getdate()
select datepart(day, datediff(day, 0, @date) / 7 * 7) / 7 + 1 

但相反,结果是:

Date       -> week Number
2015-07-01 -> 1
2015-07-06 -> 2
2015-07-13 -> 3

如何获取SQL Server中的第一种格式?

提前致谢

1 个答案:

答案 0 :(得分:0)

这似乎得到了正确的答案

    public void OnTangoPoseAvailable(Tango.TangoPoseData pose)
    {
        // Do nothing if we don't get a pose
        if (pose == null)
        {
            Debug.Log("TangoPoseData is null.");
            return;
        }
        // The callback pose is for device with respect to start of service pose.
        if (pose.framePair.baseFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE &&
            pose.framePair.targetFrame == TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE)
        {
            if (pose.status_code == TangoEnums.TangoPoseStatusType.TANGO_POSE_VALID)
            {

                // Cache the position and rotation to be set in the update function.
                m_tangoPosition = new Vector3((float)pose.translation [0],
                                              (float)pose.translation [1],
                                              (float)pose.translation [2]);

                m_tangoRotation = new Quaternion((float)pose.orientation [0],
                                                 (float)pose.orientation [1],
                                                 (float)pose.orientation [2],
                                                 (float)pose.orientation [3]);
//                Debug.Log("Tango VALID pose: " + m_tangoPosition + " " + m_tangoRotation);
            }
        }
    }