Show specific UTC for a Vb 6.0 project [closed]










-1















How to reflect a specific UTC in a VB 6.0 Label in a form. this program will be used by multiple computer with different desktop time so i want 1 UTC to be reflected on that Label.



you see, i'm creating a employee monitoring system for our office, this will be accessed by different computers of different employees in our office that has different desktop time depending on their client but i want my program to show Philippine time only when they're logging in to the monitoring system.










share|improve this question















closed as unclear what you're asking by jmcilhinney, GSerg, IvanH, Peter Cooper Jr., deblocker Nov 23 '18 at 8:03


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

    – jmcilhinney
    Nov 15 '18 at 3:56











  • sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

    – Jannelyn Morales
    Nov 16 '18 at 12:11











  • Possible duplicate of Convert UTC time to local

    – GSerg
    Nov 16 '18 at 12:21











  • Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

    – Jannelyn Morales
    Nov 16 '18 at 15:15















-1















How to reflect a specific UTC in a VB 6.0 Label in a form. this program will be used by multiple computer with different desktop time so i want 1 UTC to be reflected on that Label.



you see, i'm creating a employee monitoring system for our office, this will be accessed by different computers of different employees in our office that has different desktop time depending on their client but i want my program to show Philippine time only when they're logging in to the monitoring system.










share|improve this question















closed as unclear what you're asking by jmcilhinney, GSerg, IvanH, Peter Cooper Jr., deblocker Nov 23 '18 at 8:03


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

    – jmcilhinney
    Nov 15 '18 at 3:56











  • sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

    – Jannelyn Morales
    Nov 16 '18 at 12:11











  • Possible duplicate of Convert UTC time to local

    – GSerg
    Nov 16 '18 at 12:21











  • Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

    – Jannelyn Morales
    Nov 16 '18 at 15:15













-1












-1








-1








How to reflect a specific UTC in a VB 6.0 Label in a form. this program will be used by multiple computer with different desktop time so i want 1 UTC to be reflected on that Label.



you see, i'm creating a employee monitoring system for our office, this will be accessed by different computers of different employees in our office that has different desktop time depending on their client but i want my program to show Philippine time only when they're logging in to the monitoring system.










share|improve this question
















How to reflect a specific UTC in a VB 6.0 Label in a form. this program will be used by multiple computer with different desktop time so i want 1 UTC to be reflected on that Label.



you see, i'm creating a employee monitoring system for our office, this will be accessed by different computers of different employees in our office that has different desktop time depending on their client but i want my program to show Philippine time only when they're logging in to the monitoring system.







vb6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 12:14









jmcilhinney

26.1k22032




26.1k22032










asked Nov 15 '18 at 3:12









Jannelyn MoralesJannelyn Morales

194




194




closed as unclear what you're asking by jmcilhinney, GSerg, IvanH, Peter Cooper Jr., deblocker Nov 23 '18 at 8:03


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by jmcilhinney, GSerg, IvanH, Peter Cooper Jr., deblocker Nov 23 '18 at 8:03


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

    – jmcilhinney
    Nov 15 '18 at 3:56











  • sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

    – Jannelyn Morales
    Nov 16 '18 at 12:11











  • Possible duplicate of Convert UTC time to local

    – GSerg
    Nov 16 '18 at 12:21











  • Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

    – Jannelyn Morales
    Nov 16 '18 at 15:15

















  • If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

    – jmcilhinney
    Nov 15 '18 at 3:56











  • sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

    – Jannelyn Morales
    Nov 16 '18 at 12:11











  • Possible duplicate of Convert UTC time to local

    – GSerg
    Nov 16 '18 at 12:21











  • Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

    – Jannelyn Morales
    Nov 16 '18 at 15:15
















If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

– jmcilhinney
Nov 15 '18 at 3:56





If this is a VB6 project then why have you tagged the question as VB.NET but not VB6? Also, do you want UTC or Philippines time? UTC is a specific time zone. It's not a general term for any time zone.

– jmcilhinney
Nov 15 '18 at 3:56













sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

– Jannelyn Morales
Nov 16 '18 at 12:11





sorry im a newbie on this site, yes i'm actually trying to show the philippine time in a label inside a vb 6.0 form. Can you please help me? Thank you very much!

– Jannelyn Morales
Nov 16 '18 at 12:11













Possible duplicate of Convert UTC time to local

– GSerg
Nov 16 '18 at 12:21





Possible duplicate of Convert UTC time to local

– GSerg
Nov 16 '18 at 12:21













Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

– Jannelyn Morales
Nov 16 '18 at 15:15





Actually its different as i want a specific country time to be followed on my vb project regardless of what time or date is displayed on my desktop

– Jannelyn Morales
Nov 16 '18 at 15:15












1 Answer
1






active

oldest

votes


















1














You could do something like this:



Private Sub Timer1_Timer()
Dim datUTC As Date

datUTC = Time_LocalToUTC(Now)

Me.lblCurrentTimeActual.Caption = Now
Me.lblUTCTimeActual.Caption = CStr(datUTC)
Me.lblPhilippinesTimeActual.Caption = CStr(DateAdd("h", 8, datUTC))


End Sub

Public Function Time_LocalToUTC(ByVal the_date As Date) As Date
On Error GoTo ErrorTrap
' Create a new instance of the WScript Shell
Dim oWshshell As Variant
Dim UTCOffset As Long

Set oWshshell = CreateObject("WScript.Shell")

' Copy the Universal Time clock offset from the registry this does account for daylight savings
UTCOffset = oWshshell.RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformationActiveTimeBias")

'Take the present system time and add in the UTC offset from the registry. The 1440 is produced
'by taking 60 * 24 since the units for a day have 1 equaling a day
Time_LocalToUTC = the_date + (UTCOffset / 1440)
GoTo EndCleanup
ErrorTrap:
MsgBox "Error: " & Err.Description, vbOKCancel, "Error Getting UTC Time"

EndCleanup:
Set oWshshell = Nothing
End Function[enter image description here][1]





share|improve this answer























  • thank you :) i'll try if this at home and will update you if this has solved my problem.

    – Jannelyn Morales
    Nov 29 '18 at 2:01











  • Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

    – Jannelyn Morales
    Dec 9 '18 at 1:47












  • Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

    – Jannelyn Morales
    Dec 9 '18 at 1:50

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You could do something like this:



Private Sub Timer1_Timer()
Dim datUTC As Date

datUTC = Time_LocalToUTC(Now)

Me.lblCurrentTimeActual.Caption = Now
Me.lblUTCTimeActual.Caption = CStr(datUTC)
Me.lblPhilippinesTimeActual.Caption = CStr(DateAdd("h", 8, datUTC))


End Sub

Public Function Time_LocalToUTC(ByVal the_date As Date) As Date
On Error GoTo ErrorTrap
' Create a new instance of the WScript Shell
Dim oWshshell As Variant
Dim UTCOffset As Long

Set oWshshell = CreateObject("WScript.Shell")

' Copy the Universal Time clock offset from the registry this does account for daylight savings
UTCOffset = oWshshell.RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformationActiveTimeBias")

'Take the present system time and add in the UTC offset from the registry. The 1440 is produced
'by taking 60 * 24 since the units for a day have 1 equaling a day
Time_LocalToUTC = the_date + (UTCOffset / 1440)
GoTo EndCleanup
ErrorTrap:
MsgBox "Error: " & Err.Description, vbOKCancel, "Error Getting UTC Time"

EndCleanup:
Set oWshshell = Nothing
End Function[enter image description here][1]





share|improve this answer























  • thank you :) i'll try if this at home and will update you if this has solved my problem.

    – Jannelyn Morales
    Nov 29 '18 at 2:01











  • Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

    – Jannelyn Morales
    Dec 9 '18 at 1:47












  • Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

    – Jannelyn Morales
    Dec 9 '18 at 1:50















1














You could do something like this:



Private Sub Timer1_Timer()
Dim datUTC As Date

datUTC = Time_LocalToUTC(Now)

Me.lblCurrentTimeActual.Caption = Now
Me.lblUTCTimeActual.Caption = CStr(datUTC)
Me.lblPhilippinesTimeActual.Caption = CStr(DateAdd("h", 8, datUTC))


End Sub

Public Function Time_LocalToUTC(ByVal the_date As Date) As Date
On Error GoTo ErrorTrap
' Create a new instance of the WScript Shell
Dim oWshshell As Variant
Dim UTCOffset As Long

Set oWshshell = CreateObject("WScript.Shell")

' Copy the Universal Time clock offset from the registry this does account for daylight savings
UTCOffset = oWshshell.RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformationActiveTimeBias")

'Take the present system time and add in the UTC offset from the registry. The 1440 is produced
'by taking 60 * 24 since the units for a day have 1 equaling a day
Time_LocalToUTC = the_date + (UTCOffset / 1440)
GoTo EndCleanup
ErrorTrap:
MsgBox "Error: " & Err.Description, vbOKCancel, "Error Getting UTC Time"

EndCleanup:
Set oWshshell = Nothing
End Function[enter image description here][1]





share|improve this answer























  • thank you :) i'll try if this at home and will update you if this has solved my problem.

    – Jannelyn Morales
    Nov 29 '18 at 2:01











  • Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

    – Jannelyn Morales
    Dec 9 '18 at 1:47












  • Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

    – Jannelyn Morales
    Dec 9 '18 at 1:50













1












1








1







You could do something like this:



Private Sub Timer1_Timer()
Dim datUTC As Date

datUTC = Time_LocalToUTC(Now)

Me.lblCurrentTimeActual.Caption = Now
Me.lblUTCTimeActual.Caption = CStr(datUTC)
Me.lblPhilippinesTimeActual.Caption = CStr(DateAdd("h", 8, datUTC))


End Sub

Public Function Time_LocalToUTC(ByVal the_date As Date) As Date
On Error GoTo ErrorTrap
' Create a new instance of the WScript Shell
Dim oWshshell As Variant
Dim UTCOffset As Long

Set oWshshell = CreateObject("WScript.Shell")

' Copy the Universal Time clock offset from the registry this does account for daylight savings
UTCOffset = oWshshell.RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformationActiveTimeBias")

'Take the present system time and add in the UTC offset from the registry. The 1440 is produced
'by taking 60 * 24 since the units for a day have 1 equaling a day
Time_LocalToUTC = the_date + (UTCOffset / 1440)
GoTo EndCleanup
ErrorTrap:
MsgBox "Error: " & Err.Description, vbOKCancel, "Error Getting UTC Time"

EndCleanup:
Set oWshshell = Nothing
End Function[enter image description here][1]





share|improve this answer













You could do something like this:



Private Sub Timer1_Timer()
Dim datUTC As Date

datUTC = Time_LocalToUTC(Now)

Me.lblCurrentTimeActual.Caption = Now
Me.lblUTCTimeActual.Caption = CStr(datUTC)
Me.lblPhilippinesTimeActual.Caption = CStr(DateAdd("h", 8, datUTC))


End Sub

Public Function Time_LocalToUTC(ByVal the_date As Date) As Date
On Error GoTo ErrorTrap
' Create a new instance of the WScript Shell
Dim oWshshell As Variant
Dim UTCOffset As Long

Set oWshshell = CreateObject("WScript.Shell")

' Copy the Universal Time clock offset from the registry this does account for daylight savings
UTCOffset = oWshshell.RegRead("HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformationActiveTimeBias")

'Take the present system time and add in the UTC offset from the registry. The 1440 is produced
'by taking 60 * 24 since the units for a day have 1 equaling a day
Time_LocalToUTC = the_date + (UTCOffset / 1440)
GoTo EndCleanup
ErrorTrap:
MsgBox "Error: " & Err.Description, vbOKCancel, "Error Getting UTC Time"

EndCleanup:
Set oWshshell = Nothing
End Function[enter image description here][1]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 18:09









Eric MoonEric Moon

112




112












  • thank you :) i'll try if this at home and will update you if this has solved my problem.

    – Jannelyn Morales
    Nov 29 '18 at 2:01











  • Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

    – Jannelyn Morales
    Dec 9 '18 at 1:47












  • Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

    – Jannelyn Morales
    Dec 9 '18 at 1:50

















  • thank you :) i'll try if this at home and will update you if this has solved my problem.

    – Jannelyn Morales
    Nov 29 '18 at 2:01











  • Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

    – Jannelyn Morales
    Dec 9 '18 at 1:47












  • Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

    – Jannelyn Morales
    Dec 9 '18 at 1:50
















thank you :) i'll try if this at home and will update you if this has solved my problem.

– Jannelyn Morales
Nov 29 '18 at 2:01





thank you :) i'll try if this at home and will update you if this has solved my problem.

– Jannelyn Morales
Nov 29 '18 at 2:01













Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

– Jannelyn Morales
Dec 9 '18 at 1:47






Dim WithEvents kell As Timer Private Sub kell_Timer() Label1.Caption = Format$(Time, "hh:mm AM/PM") Label2.Caption = Format$(Now, " mmmm dd, yyyy") Label5.Caption = Format$(Now, "mm_dd_yyyy") Label6.Caption = Format$(Time, "hh_mm_AM/PM") End Sub Private Sub Form_Load() Set kell = Form3.Controls.Add("vb.timer", "kell", Form3) With kell: .Interval = 200: .Enabled = True: End With End Sub

– Jannelyn Morales
Dec 9 '18 at 1:47














Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

– Jannelyn Morales
Dec 9 '18 at 1:50





Eric Moon, the code above will get me the current time set for my pc, can you please teach me how to apply the code you have given me? sorry, i just dont know how to merge that code with my project

– Jannelyn Morales
Dec 9 '18 at 1:50





這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3