Hello!
I am trying to “slice” a text information like “Fri May 27 12:43:11 CEST 2005” into a datefield.
I have solved to seperate the date and time parts as stings.
But which method I should use to convert it into a datefield.
Thx,
Roland
–
var jahr = utils.stringRight(datestring, 4);
var tag = utils.stringMiddle(datestring, 9, 2);
var monat = utils.stringMiddle(datestring, 5, 3);
var monat_nr =1
if (monat == “Jan”) {monat_nr=“01”}
if (monat == “Feb”) {monat_nr=“02”}
if (monat == “Mar”) {monat_nr=“03”}
if (monat == “Apr”) {monat_nr=“04”}
if (monat == “May”) {monat_nr=“05”}
if (monat == “Jun”) {monat_nr=“06”}
if (monat == “Jul”) {monat_nr=“07”}
if (monat == “Aug”) {monat_nr=“08”}
if (monat == “Sep”) {monat_nr=“09”}
if (monat == “Okt”) {monat_nr=“10”}
if (monat == “Nov”) {monat_nr=“11”}
if (monat == “Dez”) {monat_nr=“12”}
date_ = tag+‘.’+monat_nr+‘.’+jahr;
time_ = utils.stringMiddle(datestring, 12,
;
Are you sure that this
Fri May 27 12:43:11 CEST 2005
is a “text information”? It looks very much like a date already…
Where does that “text” come from?[/code]
This comes from pop3 account
It is a date, which i try to store in a date field.
I get it with nachricht.getSentDate()
I could not put it into date field directly
I have to store it in a text field and convert afterwards.
I would expect a function called “getSentDate” to deliver a date and not text. What happens if you do a typeOf of the result you are getting? What is the exact field type of the date field you tried to insert this value?
patrick:
I would expect a function called “getSentDate” to deliver a date and not text. What happens if you do a typeOf of the result you are getting? What is the exact field type of the date field you tried to insert this value?
I do also expect to get a Date, but if I try
datefield = nachricht.getSentDate()
my datefield stays emtpy. Only if I try
textfield = nachricht.getSentDate()
seem to work.
Sybase Date Format is “dd-mm-yyyy hh:mm:ss”
I am not familiar with the function typeOf. I did not found it in the helpsystem. How is the syntax?
What happens if you do
var sentDate = nachricht.getSentDate()
var aDate = new Date(aDate)
how does aDate look like?
var sentDate = nachricht.getSentDate()
myDateField = new Date(sentDate)
works!
Many Thanks again to munic!