Convert date to GMT +5.30

I'm assuming that you're using VBscript. Since classic ASP/VB does not support UTC, the best way is to use MSSQL. This first bit will set up a recordset which calls the UTC date and time, adjusted to Mumbai (UTC/GMT + 5.3 hours). Be sure to change the cmd.ActiveConnection value:

<%
Dim rsdatetime
Dim rsdatetime_cmd
Dim rsdatetime_numRows

Set rsdatetime_cmd = Server.CreateObject ("ADODB.Command")
rsdatetime_cmd.ActiveConnection = your_connection_string
rsdatetime_cmd.CommandText = "SELECT getutcdate() +.229 AS today"
rsdatetime_cmd.Prepared = true

Set rsdatetime = rsdatetime_cmd.Execute
rsdatetime_numRows = 0
%>

You can then use the following in your form:

<%=(rsdatetime.Fields.Item("today").Value)%>

You can also use this directly in your script which creates the record if you don't want to incorporate it in a form element value. Don't forget to close the recordset at the end of it all:

<%
rsdatetime.Close()
Set rsdatetime = Nothing
%>
 
Back
Top