Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

set datetime field to specific output format

Avatar

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
scottb6639504
Level 1

03-09-2019

Hi Everyone,

I currently have a date and time field in an Adobe Dynamic XML Form, where I need the user to enter a date, time and the GMT timezone they are in.

Initially i broke this down into several fields: A date field,. and hour, minute, seconds and Timezone field which i concatonated through the following onExit Script:

var TreatDate = form1.treatvendate.rawValue;

var TreatHour =form1.treattimeH.rawValue;

var TreatMinute = form1.treattimeM.rawValue;

var TreatAMPM = form1.treattimeAMPM.rawValue;

var TreatTimezone = form1.treattimeTimezone.rawValue;

form1.DateTimeField2.rawValue = TreatDate + "T" + TreatHour + ":" + TreatMinute + TreatAMPM + TreatTimezone;

the problem I am running into into is when this concationated string is passed into the XML file when a submit button is pressed, the XML is invalid as the tag in the XML schema is expecting the following format:

<DateTime>2019-09-01T04:20:00+10:00</DateTime>

Now i get very close for an automatic date (ie getting the date the submit button was clicked) using the following Javascript:

var formattedDate = this.rawValue;

form1.subform1.DateTimeField2.rawValue = util.printd("date{YYYY-MM-DD}Ttime{HH:MM:SS}", formattedDate);

but it does not transfer across the timezone.

So my Question is two-fold:

1) how do I add the timezone requirement to

form1.subform1.DateTimeField2.rawValue = util.printd("date{YYYY-MM-DD}Ttime{HH:MM:SS}", formattedDate);

2) how do i Convert the below result into a valid datetime datatype?

form1.DateTimeField2.rawValue = TreatDate + "T" + TreatHour + ":" + TreatMinute + TreatAMPM + TreatTimezone;

Please let me know if you need additional information!

Thanks!

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

03-09-2019

Try using

util.printd("date{YYYY-MM-DD}Ttime{HH:MM:SSzz}", formattedDate)

For you second question, what are the values of TreatTimezone

Avatar

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
scottb6639504
Level 1

04-09-2019

Alternatively, how can I concatenate two Date/Time fields, one with the date in YYYY-MM-DD format, and one with a time format of HH:MM:SSzz

Avatar

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
scottb6639504
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
scottb6639504
Level 1

04-09-2019

Hi there!!

thanks for the answer to the first part!!!

in relation to The 2nd part, the treatTimeZone is currently a free text field (defaulted to +10:00)