Convert date from "internet" to "New York, USA" - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Convert date from "internet" to "New York, USA" - Solved
How do I change "Mon, 23 Jan 2017 21:45:00 -0500" to "1/17/2017 11:45 AM" (Eastern Standard) ?
I have tried everything, even read several topics in the dictionary, without any success.
After six hours of trying, I cannot solve this problem.
Any help would be appreciated,
David
I have tried everything, even read several topics in the dictionary, without any success.
After six hours of trying, I cannot solve this problem.
Any help would be appreciated,
David
Last edited by DR White on Fri Jan 06, 2017 11:13 am, edited 2 times in total.
Re: Convert date from "internet" to "Eastern Standard"
Hi David,
no idea what "Eastern standard" is, but I doubt that the difference to internet date is really 6 (SIX) days!
Best
Klaus
no idea what "Eastern standard" is, but I doubt that the difference to internet date is really 6 (SIX) days!

Best
Klaus
Re: Convert date from "internet" to "Eastern Standard"
Time conversion can be tricky, best start is to look up "set the useSystemDate to true" and the "convert" command.
Re: Convert date from "internet" to "Eastern Standard"
Eastern standard is actually the same as New York, USA .
I just need the format to be 1/17/2017 11:45 AM form internet format.
Thanks,
David
I just need the format to be 1/17/2017 11:45 AM form internet format.
Thanks,
David
Re: Convert date from "internet" to "New York, USA"
Hi David,
maybe something like this will do:
But no chance this will EVER result in january 17th!
Best
Klaus
maybe something like this will do:
Code: Select all
...
put "Mon, 23 Jan 2017 21:45:00 -0500" into tDate
put tDate into tTime
convert tDate from internet date to short system date
convert tTime to system time
put tDate && tTime
...

Best
Klaus
Re: Convert date from "internet" to "New York, USA"
Klaus,
I am not where I can try the code today, I will tomorrow.
What does the "&&" do?
Thanks,
David
I am not where I can try the code today, I will tomorrow.
What does the "&&" do?
Thanks,
David
Re: Convert date from "internet" to "New York, USA"
Code: Select all
answer "Ask" && "the" && "dictionary" & "!"

Re: Convert date from "internet" to "New York, USA"
Hi.
This is just a matter of parsing your input date and time, whatever format that might be in, and rebuilding it by hand. You may want to play with the "internet date", the system date, the long date and long time, those sorts of things. You will see the various parts of these functions, and then it is just a matter of extracting the pertinent components and re-assembling. It is fun if you don't have to do it too often.
What did you use instead of "&&"? The space constant? Or perhaps " " ?
In any case, do get used to "&&". Very compact, and oftentimes you will find, especially in the above exercise, that the use of "&" and "&&" usually go together when building strings, which is exactly what you will be doing.
Craig Newman
This is just a matter of parsing your input date and time, whatever format that might be in, and rebuilding it by hand. You may want to play with the "internet date", the system date, the long date and long time, those sorts of things. You will see the various parts of these functions, and then it is just a matter of extracting the pertinent components and re-assembling. It is fun if you don't have to do it too often.
What did you use instead of "&&"? The space constant? Or perhaps " " ?
In any case, do get used to "&&". Very compact, and oftentimes you will find, especially in the above exercise, that the use of "&" and "&&" usually go together when building strings, which is exactly what you will be doing.
Craig Newman
Re: Convert date from "internet" to "New York, USA"
dunbarx,
Thanks for that explanation.
Klause,
Your date conversion code works good,
Thanks,
David
Thanks for that explanation.
Klause,
Your date conversion code works good,
Thanks,
David
Re: Convert date from "internet" to "New York, USA" - Solved
Or even shorter:
Code: Select all
get the internet date
convert it to short date and time
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Convert date from "internet" to "New York, USA" - Solved
Yep!jacque wrote:Or even shorter:Code: Select all
get the internet date convert it to short date and time

I had something like this in mind, but used the && operator (... to date && time) which threw an error.
So AND is the magic word for convert here, thanks for the reminder!
Re: Convert date from "internet" to "New York, USA" - Solved
Alas, Klaus, your HyperCard history has left you. 

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Convert date from "internet" to "New York, USA" - Solved
Well, to be honest, I don't have one!jacque wrote:Alas, Klaus, your HyperCard history has left you.

Re: Convert date from "internet" to "New York, USA" - Solved
Jacque.
True. I have never seen Klaus reference HC. I believe he has heard of it, but that is all.
Craig
True. I have never seen Klaus reference HC. I believe he has heard of it, but that is all.
Craig
Re: Convert date from "internet" to "New York, USA" - Solved
I could have sworn I'd known him since the HC list...that's how ubiquitous he is. 

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com