나는 지금은 사용자 다음 정상 회담을 인도에서 질문이있는 경우와 같이, 사용자의 시간대 또는 사용자의 컴퓨터 모델에 따라 시간을 표시하려면, 데이터베이스 UTC의 날짜 시간이 사용자 가이 에 미국가는 경우 사용자 다음은 미국에 따라 표시, 인도에 따라 제출 한 날짜를 볼 수 있으며 사용자 B는 중국에있는 경우 다음 그는 따라서 그 질문을 볼 수 있습니다 ~ 치 na. C# 또는 javascript를 통해 어떻게 할 수 있습니까? 누구든지 저를 도울 수 있습니다.날짜 시간은 고객의 위치에 따라
0
A
답변
1
당신 브라우저에서 필요한 정보를 수집하기 위해 자바 스크립트를 사용해야합니다 - 당신은 당신이 설정을 다시 사용할 수있는 TimeZone
/TimeZoneInfo
이 UTC를 조정 할 수 있습니다이 정보가있을 때 http://www.pageloom.com/automatic-timezone-detection-with-javascript
볼이 부분을 DateTime
값.
더 쉬운 또 다른 옵션은 jQuery plugin called TimeAgo입니다.
자세한 내용은 참조하십시오 C# UTC to Users Local Time
0
당신은 자바 스크립트를 사용하여 .. 이런 식으로 할 수 .....
이 코드는 .... 당신이 클라이언트의 시간대가 표준 형식으로 오프셋 줄 것이다
<script type="text/javascript">
// Original script by Josh Fraser (http://www.onlineaspect.com)
// Some customization applied in this script code
var minutes;
function calculate_time_zone() {
var rightNow = new Date();
var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); // jan 1st
var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0); // june 1st
var temp = jan1.toGMTString();
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ") - 1));
temp = june1.toGMTString();
var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ") - 1));
var std_time_offset = (jan1 - jan2)/(1000 * 60 * 60);
var daylight_time_offset = (june1 - june2)/(1000 * 60 * 60);
var dst;
if (std_time_offset == daylight_time_offset) {
dst = "0"; // daylight savings time is NOT observed
} else {
// positive is southern, negative is northern hemisphere
var hemisphere = std_time_offset - daylight_time_offset;
if (hemisphere >= 0)
std_time_offset = daylight_time_offset;
dst = "1"; // daylight savings time is observed
}
var i;
// Here set the value of hidden field to the ClientTimeZone.
minutes = convert(std_time_offset);
TimeField = document.getElementById("HiddenFieldClientTime");
TimeField.value = minutes;
alert('your time zone is ' + minutes);
}
// This function is to convert the timezoneoffset to Standard format
function convert(value) {
var hours = parseInt(value);
value -= parseInt(value);
value *= 60;
var mins = parseInt(value);
value -= parseInt(value);
value *= 60;
var secs = parseInt(value);
var display_hours = hours;
// handle GMT case (00:00)
if (hours == 0) {
display_hours = "00";
} else if (hours > 0) {
// add a plus sign and perhaps an extra 0
display_hours = (hours < 10) ? "+0" + hours : "+" + hours;
} else {
// add an extra 0 if needed
display_hours = (hours > -10) ? "-0" + Math.abs(hours) : hours;
}
mins = (mins < 10) ? "0" + mins : mins;
return display_hours + ":" + mins;
}
// Adding the function to onload event of document object
onload = calculate_time_zone;
</script>
난 당신이 pls는 this link
통해 이동이 하나 time detection
0123을 살펴 권장관련 문제
- 1. 날짜/시간은 javascript에서 버그입니까?
- 2. 날짜 시간은 일시적
- 3. 남은 시간은 얼마나됩니까? PHP + 날짜
- 4. 위치에 따라 시간대 계산하기 [레일즈]
- 5. 위치에 따라 사용자를 리디렉션합니다.
- 6. 위치에 따라 마커 제거
- 7. 터치 위치에 따라 CGPath를 따라 UIView 이동하기
- 8. 스크롤 위치에 따라 div의 내용을 변경하는 jQuery
- 9. 배열의 위치에 따라 점수가 달라집니다.
- 10. 사용자 위치에 따라 날씨 표시
- 11. 위치에 따라 그래픽 렌더링이 다름
- 12. 이미지는 위치에 따라 다르게 렌더링됩니다.
- 13. 재배치 div의 클릭 위치에 따라
- 14. 사용자 위치에 따라 통화를 감지합니까?
- 15. 위치에 따라 텍스트 자동 업데이트
- 16. 구문 분석 날짜 시간은 파일 이름
- 17. 날짜 시간은 내가 asp.net MVC 3보기에서이 부분을보기
- 18. Python - 날짜 시간의 시간은 항상 0입니다.
- 19. 날짜/시간은 부동 소수점으로 저장되며 알고리즘이 사용됩니까?
- 20. 날짜 시간 전용 시간은 사용자가 하드 코드했습니다
- 21. 은 어떻게 JQuery와 DatePicker에서 날짜 시간은 날짜 시간
- 22. 날짜 만 입력하는 경우 데이터베이스의 날짜/시간 필드의 시간은 어떻게됩니까?
- 23. WiX : 빌드 및 사이트 위치에 따라 다른 위치에 설치
- 24. 시간은
- 25. 플롯 시간은
- 26. 날짜 시간은 GET하지 않는에서 온</p> <p>하지만 날짜 시간 값 (내 컴퓨터의 형식에 따라) POST
- 27. HttpWebRequests가 실행되는 위치에 따라 다른 repsonses 받기
- 28. 마우스 위치에 따라 커서를 변경하는 방법은 무엇입니까?
- 29. 문서 위치에 따라 Js 파일에서 리디렉션
- 30. 파일 위치에 따라 다른 데이터베이스를 사용하는 방법
가능한 복제본 [C# UTC - 사용자 현지 시간] (http://stackoverflow.com/questions/4066275/c-sharp-utc-to-users-local-time) – Damith