本文介绍了在vbscript中处理时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用vbs更改一些旧的.asp文件.我们的数据库将转换为UTC的存储日期,但是在网页上,数据库应该显示欧洲/赫尔辛基"时区的日期和时间(

I'm trying to change some old .asp files with vbs. Our database is going to be converted to store dates in UTC, but on webpages it should show dates and time in "Europe/Helsinki" timezone(

TimeZoneInfo.FindSystemTimeZoneById("FLE Standard Time")

在C#中为

).如何使用dbquery转换从数据库查询中获得的UTC日期(查询也在.asp文件中运行,并将结果放入表中)以使用vbscript校正日期时间?

in c#). How can I cast the UTC date I get from db query( the query is run in the .asp file as well and the result put into table) to correct date time using vbscript?

推荐答案

只需使用 DateAdd() .

Const EETOffset = -2 'EET offset from UTC is -2 hours
Dim dbDateValue  'Assumed value from DB
Dim newDate
'... DB process to populate dbDateValue
newDate = DateAdd("h", EETOffset, dbDateValue)

根据所使用的RDMS,您甚至应该能够在日期作为初始查询的一部分到达页面之前对其进行操作.

Depending on the RDMS you are using you should even be able to manipulate the dates before they get to the page as part of the initial query.

  • Format current date and time
  • How to format a datetime with minimal separators and timezone in VBScript?

这篇关于在vbscript中处理时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:36
查看更多