GopiChand9
Technical User
Hi,
I recived the datetime format in CT timezone. Since the OS TZ is CST or CDT I need to convert CT to CST/CDT and then I will conver the datetime format to GMT at different daylight saving time.
I am following this method. But I am not happy. If some one has good solution please forward me.
---
set createDate "10/20/2003 00:56:00 CT"
set extTrxGMTDate [dt2DesyDateTimeGMT $createDate]
elog INFO "DEBUG -- > $extTrxGMTDate"
proc dt2DesyDateTimeGMT { d } {
if { [string length $d] == 0 } { return "" }
set agmtdate [clock format [clock seconds] -gmt 1]
elog INFO "DEBUG -- > $agmtdate"
set agmttdate [clock scan $agmtdate -gmt 1]
elog INFO "DEBUG -- > $agmttdate"
set agmtttdate [clock format $agmttdate -format "\%Y\%m\%d\%H" -gmt 1]
elog INFO "DEBUG -- > $agmtttdate"
set bgmtdate [clock format [clock seconds]]
elog INFO "DEBUG -- > $bgmtdate"
set bgmttdate [clock scan $bgmtdate]
elog INFO "DEBUG -- > $bgmttdate"
set bgmtttdate [clock format $bgmttdate -format "\%Y\%m\%d\%H"]
elog INFO "DEBUG -- > $bgmtttdate"
set finalGMTDate [expr $agmtttdate - $bgmtttdate]
elog INFO "DEBUG -- > $finalGMTDate"
if { $finalGMTDate == -1 } {
regsub CT $d CST dm
} else {
regsub CT $d CDT dm
}
set dd [string range $dm 0 22]
set ddi [clock scan $dd -gmt 1]
return [clock format $ddi -format "\%Y\%m\%d \%H\%M\%S00" -gmt 1]
# return [clock format $ddi -format "\%Y\%m\%d \%H\%M\%S00"]
}
Thanks and Best Regards
Gopi
I recived the datetime format in CT timezone. Since the OS TZ is CST or CDT I need to convert CT to CST/CDT and then I will conver the datetime format to GMT at different daylight saving time.
I am following this method. But I am not happy. If some one has good solution please forward me.
---
set createDate "10/20/2003 00:56:00 CT"
set extTrxGMTDate [dt2DesyDateTimeGMT $createDate]
elog INFO "DEBUG -- > $extTrxGMTDate"
proc dt2DesyDateTimeGMT { d } {
if { [string length $d] == 0 } { return "" }
set agmtdate [clock format [clock seconds] -gmt 1]
elog INFO "DEBUG -- > $agmtdate"
set agmttdate [clock scan $agmtdate -gmt 1]
elog INFO "DEBUG -- > $agmttdate"
set agmtttdate [clock format $agmttdate -format "\%Y\%m\%d\%H" -gmt 1]
elog INFO "DEBUG -- > $agmtttdate"
set bgmtdate [clock format [clock seconds]]
elog INFO "DEBUG -- > $bgmtdate"
set bgmttdate [clock scan $bgmtdate]
elog INFO "DEBUG -- > $bgmttdate"
set bgmtttdate [clock format $bgmttdate -format "\%Y\%m\%d\%H"]
elog INFO "DEBUG -- > $bgmtttdate"
set finalGMTDate [expr $agmtttdate - $bgmtttdate]
elog INFO "DEBUG -- > $finalGMTDate"
if { $finalGMTDate == -1 } {
regsub CT $d CST dm
} else {
regsub CT $d CDT dm
}
set dd [string range $dm 0 22]
set ddi [clock scan $dd -gmt 1]
return [clock format $ddi -format "\%Y\%m\%d \%H\%M\%S00" -gmt 1]
# return [clock format $ddi -format "\%Y\%m\%d \%H\%M\%S00"]
}
Thanks and Best Regards
Gopi