473,395 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How best to set current system date/time in A97?

MLH
I want to change my system time date each time an A97 app is
started. Here's how I've been doing it. Am looking for a better
way. Sure some of you have researched this.

Function SnatchInterNETTD():
'************************************************* **********************
' Internet lookup used to retrieve correct time and date.
' Remove instances of "FUCKING". I could not make this
' post stick unless I changed eBay to eFUCKINGBay. Sorry
' for the inconvenience to all readers on this forum.
'************************************************* **********************
On Error GoTo Err_SnatchInterNETTD

Dim msXML As Object, strPageContent As String, MyURL As String

Set msXML = CreateObject("Microsoft.XMLHTTP")
time/month/day, but not year!
MyURL =
"http://cgi1.eFUCKINGbay.com/aw-cgi/eFUCKINGBayISAPI.dll?TimeShow&hc=1&hm=td.s5ddl7437 "
msXML.Open "GET", MyURL, False
msXML.send
strPageContent = msXML.responseText
Set msXML = Nothing

Dim DTFacts As String, TimePart As String, DatePart As String,
StartStr As String, EndStr As String, _
StartLocn As Long, EndLocn As Long, RevisedDatePart As String,
RevisedTimePart As String
StartStr = "The official eFUCKINGBay Time is now:"
EndStr = "PDT</b></p>"
StartLocn = InStr(1, strPageContent, StartStr)
EndLocn = InStr(1, strPageContent, EndStr)
If StartLocn = 0 Or EndLocn = 0 Then
DTFacts = "eFUCKINGBay has changed the code on their time server
found at the following URL:" & CRLF & CRLF
DTFacts = DTFacts &
"http://cgi1.eFUCKINGBay.com/aw-cgi/eFUCKINGBayISAPI.dll?TimeShow&hc=1&hm=td.s5ddl7437 "
MsgBox DTFacts, 64, "URL Changed -OR- Not Found - " & MyApp$ & ",
rev. " & MY_VERSION$
Exit Function
End If
DTFacts = Mid$(strPageContent, StartLocn + 40, EndLocn - StartLocn -
37) 'Should get something like "Sunday, Oct 02, 2005 15:59:22 PDT"
Debug.Print DTFacts
DatePart = left$(DTFacts, Len(DTFacts) - 13)
'Something like Sunday, Oct 02, 2005
RevisedDatePart = right$(DatePart, 12)
'Something like Oct 02, 2005
TimePart = left$(right$(DTFacts, 12), 8)
'Something like 17:27:38
RevisedTimePart = PadWithZeros(Trim$(CStr(Val(left$(TimePart, 2)) +
3)), 2, "left") & right$(TimePart, 6) 'Something like 17:27:38
Debug.Print DatePart
Debug.Print TimePart
Date = DateValue(RevisedDatePart)
Time = TimeValue(RevisedTimePart)
SnatchInterNETTD = DTFacts

Exit_SnatchInterNETTD:
Exit Function

Err_SnatchInterNETTD:
If Err = -2146697211 Then
MsgBox "Check to see if your InterNET connection is down.",
48, "Unexpected Error - " & MyApp$ & ", rev. " & MY_VERSION$
Set msXML = Nothing
Exit Function
End If
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in FN
SnatchInterNETTD in Harvell module."
k = CRLF & CRLF & str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume Exit_SnatchInterNETTD

End Function
Function PadWithZeros(String2Bpadded As String, TargetLen As Integer,
RL As String)
'************************************************* ******
' Accepts String2Bpadded (a numeric string), TargetLen
' and RL ("left" or "right").
'
' Returns String2Bpadded padded on left side with zeros
' to make it a specified length (TargetLen).
'************************************************* ******
On Error GoTo Err_PadWithZeros
Dim MyLen As Integer, HowMuchPadding As Integer, i As Integer, Padding
As String, MyMsg As String

MyLen = Len(Trim$(String2Bpadded))
HowMuchPadding = TargetLen - MyLen
If HowMuchPadding < 0 Then
MyMsg = "Your source string is already longer than the target
length to which you wish to pad it out to."
MsgBox MyMsg, 48, "Can't Pad This String - " & MyApp$ & ", rev. "
& MY_VERSION$
Exit Function
End If
For i = 1 To HowMuchPadding
Padding = Padding & "0"
Next i

Select Case RL
Case "Left"
PadWithZeros = Padding & Trim$(String2Bpadded)
Case "Right"
PadWithZeros = Trim$(String2Bpadded) & Padding
End Select

Exit_PadWithZeros:
Exit Function

Err_PadWithZeros:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in global Function
PadWithZeros."
k = CRLF & CRLF & str$(Err) & ": " & Quote & Error$ & Quote
Message3 = r & k
MsgBox Message3, 48, "Unexpected Error - " & MyApp$ & ", rev. " &
MY_VERSION$
Resume Exit_PadWithZeros

End Function

Nov 13 '05 #1
1 2170
MLH
Wow! I made it. Changing all my references to eBay in the URL
strings allowed the post to go through. However, some of my
attempts had NO problems whatsoever - and they had eBay's
name buried in the URL strings.

I'm happy this one made it through. I am trying to acquire the
current time/date and use it to set the system time/date. Going
through eBay's time/date server is a hassel - and besides, its
difficult to post questions in this forum because of the SPAM
filter that censors eBay's name in some URL strings but not
others. That's reason enough to change right there.
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
5
by: Mark Feller | last post by:
I want to provide users a page where they can browse entries in a database 10 at a time, for example. I am doing this as a table, where each row is a database entry. I want to be able to give the...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
11
by: Ken Varn | last post by:
I want to be able to determine my current line, file, and function in my C# application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___ macros for getting this, but I cannot find a...
4
by: xenophon | last post by:
I have a class that is used in an ASP.NET app, a WinForms app, and a Win32 Service. What is the best way to tell what environment the code is currently instanced in? Thanks.
6
by: Scott | last post by:
I have a start date and an end date in my project that is defaulted to the current date at run-time using the following code... Date1.Value = Now() Date2.Value = Now() I then have some code...
5
by: Robert W. | last post by:
My app runs perfectly when run in Canada or the U.S. But others are experiencing problems. So I switched my computer to the UK culture and immediately saw a problem. This line was failing: ...
29
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
6
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.